mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG.
This commit is contained in:
+32
-12
@@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "3.7";
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
function tryGetNativeMap() {
|
||||
@@ -11889,6 +11889,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 && node.operatorToken.kind === 60;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196;
|
||||
}
|
||||
@@ -24153,11 +24157,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 && flags & 64 ||
|
||||
expression.kind === 90 && flags & 32) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 && flags & 64 ||
|
||||
expression.kind === 90 && flags & 32) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -24996,7 +24999,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1:
|
||||
case 2:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
container = declName.parent.expression;
|
||||
@@ -25010,7 +25018,9 @@ var ts;
|
||||
case 0:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288, 788968);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288, 788968);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -29990,7 +30000,6 @@ var ts;
|
||||
else if (context.flags & 2048 &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -35247,7 +35256,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -37870,13 +37881,13 @@ var ts;
|
||||
}
|
||||
if (!ignoreReturnTypes) {
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
if (targetTypePredicate) {
|
||||
@@ -78958,6 +78969,15 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
|
||||
+134
-34
@@ -94,7 +94,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -15170,6 +15170,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196 /* NewExpression */;
|
||||
}
|
||||
@@ -29691,11 +29695,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -30652,7 +30655,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
@@ -30666,7 +30674,9 @@ var ts;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -36543,8 +36553,6 @@ var ts;
|
||||
else if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
// Use `import` types for refs to other scopes, only anonymize something defined in the same scope
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -42602,7 +42610,7 @@ var ts;
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
* but this function's special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSDocValueReference(node, symbol) {
|
||||
var valueType = getTypeOfSymbol(symbol);
|
||||
@@ -42614,7 +42622,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -45544,13 +45554,13 @@ var ts;
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
@@ -96122,6 +96132,16 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
// use host's cached realpath
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
@@ -112698,7 +112718,8 @@ var ts;
|
||||
}
|
||||
var declName = ts.getNameOfDeclaration(node);
|
||||
if (declName && ts.isPropertyName(declName)) {
|
||||
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
|
||||
var propertyName = ts.getPropertyNameForPropertyNameNode(declName);
|
||||
return propertyName && ts.unescapeLeadingUnderscores(propertyName);
|
||||
}
|
||||
switch (node.kind) {
|
||||
case 200 /* FunctionExpression */:
|
||||
@@ -118828,7 +118849,10 @@ var ts;
|
||||
if (ts.isCallOrNewExpression(parent)) {
|
||||
if (!parent.arguments)
|
||||
return false;
|
||||
var currentNode = ts.Debug.assertDefined(ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; }));
|
||||
var currentNode = ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; });
|
||||
// If it's not one of the arguments, don't look past this
|
||||
if (!currentNode)
|
||||
return false;
|
||||
var currentIndex = parent.arguments.indexOf(currentNode);
|
||||
if (currentIndex === 0)
|
||||
return false; // Can't look at previous node if first
|
||||
@@ -127917,7 +127941,7 @@ var ts;
|
||||
if (!selection || !ts.isTypeNode(selection))
|
||||
return undefined;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var firstStatement = ts.Debug.assertDefined(ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
|
||||
if (!typeParameters)
|
||||
return undefined;
|
||||
@@ -127948,9 +127972,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isStatementAndHasJSDoc(n) {
|
||||
return ts.isStatement(n) && ts.hasJSDocNodes(n);
|
||||
}
|
||||
function rangeContainsSkipTrivia(r1, node, file) {
|
||||
return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
|
||||
}
|
||||
@@ -134288,7 +134309,7 @@ var ts;
|
||||
var Project = /** @class */ (function () {
|
||||
/*@internal*/
|
||||
function Project(
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory, customRealpath) {
|
||||
var _this = this;
|
||||
this.projectName = projectName;
|
||||
this.projectKind = projectKind;
|
||||
@@ -134358,7 +134379,7 @@ var ts;
|
||||
this.trace = function (s) { return host.trace(s); };
|
||||
}
|
||||
if (host.realpath) {
|
||||
this.realpath = function (path) { return host.realpath(path); };
|
||||
this.realpath = customRealpath || (function (path) { return host.realpath(path); });
|
||||
}
|
||||
// Use the current directory as resolution root only if the project created using current directory string
|
||||
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory, /*logChangesWhenResolvingModule*/ true);
|
||||
@@ -135578,7 +135599,7 @@ var ts;
|
||||
/*hasExplicitListOfFiles*/ false,
|
||||
/*lastFileExceededProgramSize*/ undefined,
|
||||
/*compilerOptions*/ {},
|
||||
/*compileOnSaveEnabled*/ false, cachedDirectoryStructureHost, ts.getDirectoryPath(configFileName)) || this;
|
||||
/*compileOnSaveEnabled*/ false, cachedDirectoryStructureHost, ts.getDirectoryPath(configFileName), projectService.host.realpath && (function (s) { return _this.getRealpath(s); })) || this;
|
||||
/*@internal*/
|
||||
_this.canConfigFileJsonReportNoInputFiles = false;
|
||||
/** Ref count to the project when opened from external project */
|
||||
@@ -135596,19 +135617,31 @@ var ts;
|
||||
ConfiguredProject.prototype.setResolvedProjectReferenceCallbacks = function (projectReferenceCallbacks) {
|
||||
this.projectReferenceCallbacks = projectReferenceCallbacks;
|
||||
};
|
||||
ConfiguredProject.prototype.fileExistsIfProjectReferenceDts = function (file) {
|
||||
var source = this.projectReferenceCallbacks.getSourceOfProjectReferenceRedirect(file);
|
||||
return source !== undefined ?
|
||||
ts.isString(source) ? _super.prototype.fileExists.call(this, source) : true :
|
||||
undefined;
|
||||
};
|
||||
/**
|
||||
* This implementation of fileExists checks if the file being requested is
|
||||
* .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that file exists on host
|
||||
*/
|
||||
ConfiguredProject.prototype.fileExists = function (file) {
|
||||
if (_super.prototype.fileExists.call(this, file))
|
||||
return true;
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return false;
|
||||
if (!ts.isDeclarationFileName(file))
|
||||
return false;
|
||||
// Project references go to source file instead of .d.ts file
|
||||
if (this.useSourceOfProjectReferenceRedirect() && this.projectReferenceCallbacks) {
|
||||
var source = this.projectReferenceCallbacks.getSourceOfProjectReferenceRedirect(file);
|
||||
if (source)
|
||||
return ts.isString(source) ? _super.prototype.fileExists.call(this, source) : true;
|
||||
}
|
||||
return _super.prototype.fileExists.call(this, file);
|
||||
return this.fileOrDirectoryExistsUsingSource(file, /*isFile*/ true);
|
||||
};
|
||||
ConfiguredProject.prototype.directoryExistsIfProjectReferenceDeclDir = function (dir) {
|
||||
var dirPath = this.toPath(dir);
|
||||
var dirPathWithTrailingDirectorySeparator = "" + dirPath + ts.directorySeparator;
|
||||
return ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator); });
|
||||
};
|
||||
/**
|
||||
* This implementation of directoryExists checks if the directory being requested is
|
||||
@@ -135617,8 +135650,10 @@ var ts;
|
||||
*/
|
||||
ConfiguredProject.prototype.directoryExists = function (path) {
|
||||
var _this = this;
|
||||
if (_super.prototype.directoryExists.call(this, path))
|
||||
if (_super.prototype.directoryExists.call(this, path)) {
|
||||
this.handleDirectoryCouldBeSymlink(path);
|
||||
return true;
|
||||
}
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return false;
|
||||
if (!this.mapOfDeclarationDirectories) {
|
||||
@@ -135626,7 +135661,7 @@ var ts;
|
||||
this.projectReferenceCallbacks.forEachResolvedProjectReference(function (ref) {
|
||||
if (!ref)
|
||||
return;
|
||||
var out = ref.commandLine.options.outFile || ref.commandLine.options.outDir;
|
||||
var out = ref.commandLine.options.outFile || ref.commandLine.options.out;
|
||||
if (out) {
|
||||
_this.mapOfDeclarationDirectories.set(ts.getDirectoryPath(_this.toPath(out)), true);
|
||||
}
|
||||
@@ -135639,9 +135674,70 @@ var ts;
|
||||
}
|
||||
});
|
||||
}
|
||||
var dirPath = this.toPath(path);
|
||||
var dirPathWithTrailingDirectorySeparator = "" + dirPath + ts.directorySeparator;
|
||||
return !!ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator); });
|
||||
return this.fileOrDirectoryExistsUsingSource(path, /*isFile*/ false);
|
||||
};
|
||||
ConfiguredProject.prototype.realpathIfSymlinkedProjectReferenceDts = function (s) {
|
||||
return this.symlinkedFiles && this.symlinkedFiles.get(this.toPath(s));
|
||||
};
|
||||
ConfiguredProject.prototype.getRealpath = function (s) {
|
||||
return this.realpathIfSymlinkedProjectReferenceDts(s) ||
|
||||
this.projectService.host.realpath(s);
|
||||
};
|
||||
ConfiguredProject.prototype.handleDirectoryCouldBeSymlink = function (directory) {
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return;
|
||||
// Because we already watch node_modules, handle symlinks in there
|
||||
if (!this.realpath || !ts.stringContains(directory, ts.nodeModulesPathPart))
|
||||
return;
|
||||
if (!this.symlinkedDirectories)
|
||||
this.symlinkedDirectories = ts.createMap();
|
||||
var directoryPath = ts.ensureTrailingDirectorySeparator(this.toPath(directory));
|
||||
if (this.symlinkedDirectories.has(directoryPath))
|
||||
return;
|
||||
var real = this.projectService.host.realpath(directory);
|
||||
var realPath;
|
||||
if (real === directory ||
|
||||
(realPath = ts.ensureTrailingDirectorySeparator(this.toPath(real))) === directoryPath) {
|
||||
// not symlinked
|
||||
this.symlinkedDirectories.set(directoryPath, false);
|
||||
return;
|
||||
}
|
||||
this.symlinkedDirectories.set(directoryPath, {
|
||||
real: ts.ensureTrailingDirectorySeparator(real),
|
||||
realPath: realPath
|
||||
});
|
||||
};
|
||||
ConfiguredProject.prototype.fileOrDirectoryExistsUsingSource = function (fileOrDirectory, isFile) {
|
||||
var _this = this;
|
||||
var fileOrDirectoryExistsUsingSource = isFile ?
|
||||
function (file) { return _this.fileExistsIfProjectReferenceDts(file); } :
|
||||
function (dir) { return _this.directoryExistsIfProjectReferenceDeclDir(dir); };
|
||||
// Check current directory or file
|
||||
var result = fileOrDirectoryExistsUsingSource(fileOrDirectory);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
if (!this.symlinkedDirectories)
|
||||
return false;
|
||||
var fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
||||
if (!ts.stringContains(fileOrDirectoryPath, ts.nodeModulesPathPart))
|
||||
return false;
|
||||
if (isFile && this.symlinkedFiles && this.symlinkedFiles.has(fileOrDirectoryPath))
|
||||
return true;
|
||||
// If it contains node_modules check if its one of the symlinked path we know of
|
||||
return ts.firstDefinedIterator(this.symlinkedDirectories.entries(), function (_a) {
|
||||
var directoryPath = _a[0], symlinkedDirectory = _a[1];
|
||||
if (!symlinkedDirectory || !ts.startsWith(fileOrDirectoryPath, directoryPath))
|
||||
return undefined;
|
||||
var result = fileOrDirectoryExistsUsingSource(fileOrDirectoryPath.replace(directoryPath, symlinkedDirectory.realPath));
|
||||
if (isFile && result) {
|
||||
if (!_this.symlinkedFiles)
|
||||
_this.symlinkedFiles = ts.createMap();
|
||||
// Store the real path for the file'
|
||||
var absolutePath = ts.getNormalizedAbsolutePath(fileOrDirectory, _this.currentDirectory);
|
||||
_this.symlinkedFiles.set(fileOrDirectoryPath, "" + symlinkedDirectory.real + absolutePath.replace(new RegExp(directoryPath, "i"), ""));
|
||||
}
|
||||
return result;
|
||||
}) || false;
|
||||
};
|
||||
/**
|
||||
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
|
||||
@@ -135653,6 +135749,8 @@ var ts;
|
||||
this.pendingReload = ts.ConfigFileProgramReloadLevel.None;
|
||||
this.projectReferenceCallbacks = undefined;
|
||||
this.mapOfDeclarationDirectories = undefined;
|
||||
this.symlinkedDirectories = undefined;
|
||||
this.symlinkedFiles = undefined;
|
||||
var result;
|
||||
switch (reloadLevel) {
|
||||
case ts.ConfigFileProgramReloadLevel.Partial:
|
||||
@@ -135763,6 +135861,8 @@ var ts;
|
||||
this.configFileSpecs = undefined;
|
||||
this.projectReferenceCallbacks = undefined;
|
||||
this.mapOfDeclarationDirectories = undefined;
|
||||
this.symlinkedDirectories = undefined;
|
||||
this.symlinkedFiles = undefined;
|
||||
_super.prototype.close.call(this);
|
||||
};
|
||||
/* @internal */
|
||||
|
||||
Vendored
+9
@@ -3525,6 +3525,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
@@ -8683,23 +8684,31 @@ declare namespace ts.server {
|
||||
readonly canonicalConfigFilePath: NormalizedPath;
|
||||
private projectReferenceCallbacks;
|
||||
private mapOfDeclarationDirectories;
|
||||
private symlinkedDirectories;
|
||||
private symlinkedFiles;
|
||||
/** Ref count to the project when opened from external project */
|
||||
private externalProjectRefCount;
|
||||
private projectErrors;
|
||||
private projectReferences;
|
||||
protected isInitialLoadPending: () => boolean;
|
||||
private fileExistsIfProjectReferenceDts;
|
||||
/**
|
||||
* This implementation of fileExists checks if the file being requested is
|
||||
* .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that file exists on host
|
||||
*/
|
||||
fileExists(file: string): boolean;
|
||||
private directoryExistsIfProjectReferenceDeclDir;
|
||||
/**
|
||||
* This implementation of directoryExists checks if the directory being requested is
|
||||
* directory of .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that directory exists on host
|
||||
*/
|
||||
directoryExists(path: string): boolean;
|
||||
private realpathIfSymlinkedProjectReferenceDts;
|
||||
private getRealpath;
|
||||
private handleDirectoryCouldBeSymlink;
|
||||
private fileOrDirectoryExistsUsingSource;
|
||||
/**
|
||||
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
|
||||
* @returns: true if set of files in the project stays the same and false - otherwise.
|
||||
|
||||
+134
-34
@@ -244,7 +244,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -15320,6 +15320,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196 /* NewExpression */;
|
||||
}
|
||||
@@ -29841,11 +29845,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -30802,7 +30805,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
@@ -30816,7 +30824,9 @@ var ts;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -36693,8 +36703,6 @@ var ts;
|
||||
else if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
// Use `import` types for refs to other scopes, only anonymize something defined in the same scope
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -42752,7 +42760,7 @@ var ts;
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
* but this function's special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSDocValueReference(node, symbol) {
|
||||
var valueType = getTypeOfSymbol(symbol);
|
||||
@@ -42764,7 +42772,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -45694,13 +45704,13 @@ var ts;
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
@@ -96272,6 +96282,16 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
// use host's cached realpath
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
@@ -113211,7 +113231,8 @@ var ts;
|
||||
}
|
||||
var declName = ts.getNameOfDeclaration(node);
|
||||
if (declName && ts.isPropertyName(declName)) {
|
||||
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
|
||||
var propertyName = ts.getPropertyNameForPropertyNameNode(declName);
|
||||
return propertyName && ts.unescapeLeadingUnderscores(propertyName);
|
||||
}
|
||||
switch (node.kind) {
|
||||
case 200 /* FunctionExpression */:
|
||||
@@ -119341,7 +119362,10 @@ var ts;
|
||||
if (ts.isCallOrNewExpression(parent)) {
|
||||
if (!parent.arguments)
|
||||
return false;
|
||||
var currentNode = ts.Debug.assertDefined(ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; }));
|
||||
var currentNode = ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; });
|
||||
// If it's not one of the arguments, don't look past this
|
||||
if (!currentNode)
|
||||
return false;
|
||||
var currentIndex = parent.arguments.indexOf(currentNode);
|
||||
if (currentIndex === 0)
|
||||
return false; // Can't look at previous node if first
|
||||
@@ -128430,7 +128454,7 @@ var ts;
|
||||
if (!selection || !ts.isTypeNode(selection))
|
||||
return undefined;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var firstStatement = ts.Debug.assertDefined(ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
|
||||
if (!typeParameters)
|
||||
return undefined;
|
||||
@@ -128461,9 +128485,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isStatementAndHasJSDoc(n) {
|
||||
return ts.isStatement(n) && ts.hasJSDocNodes(n);
|
||||
}
|
||||
function rangeContainsSkipTrivia(r1, node, file) {
|
||||
return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
|
||||
}
|
||||
@@ -134438,7 +134459,7 @@ var ts;
|
||||
var Project = /** @class */ (function () {
|
||||
/*@internal*/
|
||||
function Project(
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory) {
|
||||
/*@internal*/ projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, directoryStructureHost, currentDirectory, customRealpath) {
|
||||
var _this = this;
|
||||
this.projectName = projectName;
|
||||
this.projectKind = projectKind;
|
||||
@@ -134508,7 +134529,7 @@ var ts;
|
||||
this.trace = function (s) { return host.trace(s); };
|
||||
}
|
||||
if (host.realpath) {
|
||||
this.realpath = function (path) { return host.realpath(path); };
|
||||
this.realpath = customRealpath || (function (path) { return host.realpath(path); });
|
||||
}
|
||||
// Use the current directory as resolution root only if the project created using current directory string
|
||||
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory, /*logChangesWhenResolvingModule*/ true);
|
||||
@@ -135728,7 +135749,7 @@ var ts;
|
||||
/*hasExplicitListOfFiles*/ false,
|
||||
/*lastFileExceededProgramSize*/ undefined,
|
||||
/*compilerOptions*/ {},
|
||||
/*compileOnSaveEnabled*/ false, cachedDirectoryStructureHost, ts.getDirectoryPath(configFileName)) || this;
|
||||
/*compileOnSaveEnabled*/ false, cachedDirectoryStructureHost, ts.getDirectoryPath(configFileName), projectService.host.realpath && (function (s) { return _this.getRealpath(s); })) || this;
|
||||
/*@internal*/
|
||||
_this.canConfigFileJsonReportNoInputFiles = false;
|
||||
/** Ref count to the project when opened from external project */
|
||||
@@ -135746,19 +135767,31 @@ var ts;
|
||||
ConfiguredProject.prototype.setResolvedProjectReferenceCallbacks = function (projectReferenceCallbacks) {
|
||||
this.projectReferenceCallbacks = projectReferenceCallbacks;
|
||||
};
|
||||
ConfiguredProject.prototype.fileExistsIfProjectReferenceDts = function (file) {
|
||||
var source = this.projectReferenceCallbacks.getSourceOfProjectReferenceRedirect(file);
|
||||
return source !== undefined ?
|
||||
ts.isString(source) ? _super.prototype.fileExists.call(this, source) : true :
|
||||
undefined;
|
||||
};
|
||||
/**
|
||||
* This implementation of fileExists checks if the file being requested is
|
||||
* .d.ts file for the referenced Project.
|
||||
* If it is it returns true irrespective of whether that file exists on host
|
||||
*/
|
||||
ConfiguredProject.prototype.fileExists = function (file) {
|
||||
if (_super.prototype.fileExists.call(this, file))
|
||||
return true;
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return false;
|
||||
if (!ts.isDeclarationFileName(file))
|
||||
return false;
|
||||
// Project references go to source file instead of .d.ts file
|
||||
if (this.useSourceOfProjectReferenceRedirect() && this.projectReferenceCallbacks) {
|
||||
var source = this.projectReferenceCallbacks.getSourceOfProjectReferenceRedirect(file);
|
||||
if (source)
|
||||
return ts.isString(source) ? _super.prototype.fileExists.call(this, source) : true;
|
||||
}
|
||||
return _super.prototype.fileExists.call(this, file);
|
||||
return this.fileOrDirectoryExistsUsingSource(file, /*isFile*/ true);
|
||||
};
|
||||
ConfiguredProject.prototype.directoryExistsIfProjectReferenceDeclDir = function (dir) {
|
||||
var dirPath = this.toPath(dir);
|
||||
var dirPathWithTrailingDirectorySeparator = "" + dirPath + ts.directorySeparator;
|
||||
return ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator); });
|
||||
};
|
||||
/**
|
||||
* This implementation of directoryExists checks if the directory being requested is
|
||||
@@ -135767,8 +135800,10 @@ var ts;
|
||||
*/
|
||||
ConfiguredProject.prototype.directoryExists = function (path) {
|
||||
var _this = this;
|
||||
if (_super.prototype.directoryExists.call(this, path))
|
||||
if (_super.prototype.directoryExists.call(this, path)) {
|
||||
this.handleDirectoryCouldBeSymlink(path);
|
||||
return true;
|
||||
}
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return false;
|
||||
if (!this.mapOfDeclarationDirectories) {
|
||||
@@ -135776,7 +135811,7 @@ var ts;
|
||||
this.projectReferenceCallbacks.forEachResolvedProjectReference(function (ref) {
|
||||
if (!ref)
|
||||
return;
|
||||
var out = ref.commandLine.options.outFile || ref.commandLine.options.outDir;
|
||||
var out = ref.commandLine.options.outFile || ref.commandLine.options.out;
|
||||
if (out) {
|
||||
_this.mapOfDeclarationDirectories.set(ts.getDirectoryPath(_this.toPath(out)), true);
|
||||
}
|
||||
@@ -135789,9 +135824,70 @@ var ts;
|
||||
}
|
||||
});
|
||||
}
|
||||
var dirPath = this.toPath(path);
|
||||
var dirPathWithTrailingDirectorySeparator = "" + dirPath + ts.directorySeparator;
|
||||
return !!ts.forEachKey(this.mapOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator); });
|
||||
return this.fileOrDirectoryExistsUsingSource(path, /*isFile*/ false);
|
||||
};
|
||||
ConfiguredProject.prototype.realpathIfSymlinkedProjectReferenceDts = function (s) {
|
||||
return this.symlinkedFiles && this.symlinkedFiles.get(this.toPath(s));
|
||||
};
|
||||
ConfiguredProject.prototype.getRealpath = function (s) {
|
||||
return this.realpathIfSymlinkedProjectReferenceDts(s) ||
|
||||
this.projectService.host.realpath(s);
|
||||
};
|
||||
ConfiguredProject.prototype.handleDirectoryCouldBeSymlink = function (directory) {
|
||||
if (!this.useSourceOfProjectReferenceRedirect() || !this.projectReferenceCallbacks)
|
||||
return;
|
||||
// Because we already watch node_modules, handle symlinks in there
|
||||
if (!this.realpath || !ts.stringContains(directory, ts.nodeModulesPathPart))
|
||||
return;
|
||||
if (!this.symlinkedDirectories)
|
||||
this.symlinkedDirectories = ts.createMap();
|
||||
var directoryPath = ts.ensureTrailingDirectorySeparator(this.toPath(directory));
|
||||
if (this.symlinkedDirectories.has(directoryPath))
|
||||
return;
|
||||
var real = this.projectService.host.realpath(directory);
|
||||
var realPath;
|
||||
if (real === directory ||
|
||||
(realPath = ts.ensureTrailingDirectorySeparator(this.toPath(real))) === directoryPath) {
|
||||
// not symlinked
|
||||
this.symlinkedDirectories.set(directoryPath, false);
|
||||
return;
|
||||
}
|
||||
this.symlinkedDirectories.set(directoryPath, {
|
||||
real: ts.ensureTrailingDirectorySeparator(real),
|
||||
realPath: realPath
|
||||
});
|
||||
};
|
||||
ConfiguredProject.prototype.fileOrDirectoryExistsUsingSource = function (fileOrDirectory, isFile) {
|
||||
var _this = this;
|
||||
var fileOrDirectoryExistsUsingSource = isFile ?
|
||||
function (file) { return _this.fileExistsIfProjectReferenceDts(file); } :
|
||||
function (dir) { return _this.directoryExistsIfProjectReferenceDeclDir(dir); };
|
||||
// Check current directory or file
|
||||
var result = fileOrDirectoryExistsUsingSource(fileOrDirectory);
|
||||
if (result !== undefined)
|
||||
return result;
|
||||
if (!this.symlinkedDirectories)
|
||||
return false;
|
||||
var fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
||||
if (!ts.stringContains(fileOrDirectoryPath, ts.nodeModulesPathPart))
|
||||
return false;
|
||||
if (isFile && this.symlinkedFiles && this.symlinkedFiles.has(fileOrDirectoryPath))
|
||||
return true;
|
||||
// If it contains node_modules check if its one of the symlinked path we know of
|
||||
return ts.firstDefinedIterator(this.symlinkedDirectories.entries(), function (_a) {
|
||||
var directoryPath = _a[0], symlinkedDirectory = _a[1];
|
||||
if (!symlinkedDirectory || !ts.startsWith(fileOrDirectoryPath, directoryPath))
|
||||
return undefined;
|
||||
var result = fileOrDirectoryExistsUsingSource(fileOrDirectoryPath.replace(directoryPath, symlinkedDirectory.realPath));
|
||||
if (isFile && result) {
|
||||
if (!_this.symlinkedFiles)
|
||||
_this.symlinkedFiles = ts.createMap();
|
||||
// Store the real path for the file'
|
||||
var absolutePath = ts.getNormalizedAbsolutePath(fileOrDirectory, _this.currentDirectory);
|
||||
_this.symlinkedFiles.set(fileOrDirectoryPath, "" + symlinkedDirectory.real + absolutePath.replace(new RegExp(directoryPath, "i"), ""));
|
||||
}
|
||||
return result;
|
||||
}) || false;
|
||||
};
|
||||
/**
|
||||
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
|
||||
@@ -135803,6 +135899,8 @@ var ts;
|
||||
this.pendingReload = ts.ConfigFileProgramReloadLevel.None;
|
||||
this.projectReferenceCallbacks = undefined;
|
||||
this.mapOfDeclarationDirectories = undefined;
|
||||
this.symlinkedDirectories = undefined;
|
||||
this.symlinkedFiles = undefined;
|
||||
var result;
|
||||
switch (reloadLevel) {
|
||||
case ts.ConfigFileProgramReloadLevel.Partial:
|
||||
@@ -135913,6 +136011,8 @@ var ts;
|
||||
this.configFileSpecs = undefined;
|
||||
this.projectReferenceCallbacks = undefined;
|
||||
this.mapOfDeclarationDirectories = undefined;
|
||||
this.symlinkedDirectories = undefined;
|
||||
this.symlinkedFiles = undefined;
|
||||
_super.prototype.close.call(this);
|
||||
};
|
||||
/* @internal */
|
||||
|
||||
Vendored
+1
@@ -3525,6 +3525,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
|
||||
+41
-20
@@ -233,7 +233,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -15309,6 +15309,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196 /* NewExpression */;
|
||||
}
|
||||
@@ -29830,11 +29834,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -30791,7 +30794,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
@@ -30805,7 +30813,9 @@ var ts;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -36682,8 +36692,6 @@ var ts;
|
||||
else if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
// Use `import` types for refs to other scopes, only anonymize something defined in the same scope
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -42741,7 +42749,7 @@ var ts;
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
* but this function's special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSDocValueReference(node, symbol) {
|
||||
var valueType = getTypeOfSymbol(symbol);
|
||||
@@ -42753,7 +42761,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -45683,13 +45693,13 @@ var ts;
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
@@ -96261,6 +96271,16 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
// use host's cached realpath
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
@@ -113200,7 +113220,8 @@ var ts;
|
||||
}
|
||||
var declName = ts.getNameOfDeclaration(node);
|
||||
if (declName && ts.isPropertyName(declName)) {
|
||||
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
|
||||
var propertyName = ts.getPropertyNameForPropertyNameNode(declName);
|
||||
return propertyName && ts.unescapeLeadingUnderscores(propertyName);
|
||||
}
|
||||
switch (node.kind) {
|
||||
case 200 /* FunctionExpression */:
|
||||
@@ -119330,7 +119351,10 @@ var ts;
|
||||
if (ts.isCallOrNewExpression(parent)) {
|
||||
if (!parent.arguments)
|
||||
return false;
|
||||
var currentNode = ts.Debug.assertDefined(ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; }));
|
||||
var currentNode = ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; });
|
||||
// If it's not one of the arguments, don't look past this
|
||||
if (!currentNode)
|
||||
return false;
|
||||
var currentIndex = parent.arguments.indexOf(currentNode);
|
||||
if (currentIndex === 0)
|
||||
return false; // Can't look at previous node if first
|
||||
@@ -128419,7 +128443,7 @@ var ts;
|
||||
if (!selection || !ts.isTypeNode(selection))
|
||||
return undefined;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var firstStatement = ts.Debug.assertDefined(ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
|
||||
if (!typeParameters)
|
||||
return undefined;
|
||||
@@ -128450,9 +128474,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isStatementAndHasJSDoc(n) {
|
||||
return ts.isStatement(n) && ts.hasJSDocNodes(n);
|
||||
}
|
||||
function rangeContainsSkipTrivia(r1, node, file) {
|
||||
return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -3525,6 +3525,7 @@ declare namespace ts {
|
||||
function isCallExpression(node: Node): node is CallExpression;
|
||||
function isCallChain(node: Node): node is CallChain;
|
||||
function isOptionalChain(node: Node): node is PropertyAccessChain | ElementAccessChain | CallChain;
|
||||
function isNullishCoalesce(node: Node): boolean;
|
||||
function isNewExpression(node: Node): node is NewExpression;
|
||||
function isTaggedTemplateExpression(node: Node): node is TaggedTemplateExpression;
|
||||
function isTypeAssertion(node: Node): node is TypeAssertion;
|
||||
|
||||
+41
-20
@@ -233,7 +233,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -15309,6 +15309,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196 /* NewExpression */;
|
||||
}
|
||||
@@ -29830,11 +29834,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -30791,7 +30794,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
@@ -30805,7 +30813,9 @@ var ts;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -36682,8 +36692,6 @@ var ts;
|
||||
else if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
// Use `import` types for refs to other scopes, only anonymize something defined in the same scope
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -42741,7 +42749,7 @@ var ts;
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
* but this function's special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSDocValueReference(node, symbol) {
|
||||
var valueType = getTypeOfSymbol(symbol);
|
||||
@@ -42753,7 +42761,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -45683,13 +45693,13 @@ var ts;
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
@@ -96261,6 +96271,16 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
// use host's cached realpath
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
@@ -113200,7 +113220,8 @@ var ts;
|
||||
}
|
||||
var declName = ts.getNameOfDeclaration(node);
|
||||
if (declName && ts.isPropertyName(declName)) {
|
||||
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
|
||||
var propertyName = ts.getPropertyNameForPropertyNameNode(declName);
|
||||
return propertyName && ts.unescapeLeadingUnderscores(propertyName);
|
||||
}
|
||||
switch (node.kind) {
|
||||
case 200 /* FunctionExpression */:
|
||||
@@ -119330,7 +119351,10 @@ var ts;
|
||||
if (ts.isCallOrNewExpression(parent)) {
|
||||
if (!parent.arguments)
|
||||
return false;
|
||||
var currentNode = ts.Debug.assertDefined(ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; }));
|
||||
var currentNode = ts.find(parent.arguments, function (arg) { return arg.pos === child.pos; });
|
||||
// If it's not one of the arguments, don't look past this
|
||||
if (!currentNode)
|
||||
return false;
|
||||
var currentIndex = parent.arguments.indexOf(currentNode);
|
||||
if (currentIndex === 0)
|
||||
return false; // Can't look at previous node if first
|
||||
@@ -128419,7 +128443,7 @@ var ts;
|
||||
if (!selection || !ts.isTypeNode(selection))
|
||||
return undefined;
|
||||
var checker = context.program.getTypeChecker();
|
||||
var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var firstStatement = ts.Debug.assertDefined(ts.findAncestor(selection, ts.isStatement), "Should find a statement");
|
||||
var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
|
||||
if (!typeParameters)
|
||||
return undefined;
|
||||
@@ -128450,9 +128474,6 @@ var ts;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function isStatementAndHasJSDoc(n) {
|
||||
return ts.isStatement(n) && ts.hasJSDocNodes(n);
|
||||
}
|
||||
function rangeContainsSkipTrivia(r1, node, file) {
|
||||
return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
|
||||
}
|
||||
|
||||
+34
-14
@@ -83,7 +83,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".1-rc";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -15159,6 +15159,10 @@ var ts;
|
||||
return ts.isOptionalChainRoot(node.parent) && node.parent.expression === node;
|
||||
}
|
||||
ts.isExpressionOfOptionalChainRoot = isExpressionOfOptionalChainRoot;
|
||||
function isNullishCoalesce(node) {
|
||||
return node.kind === 208 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */;
|
||||
}
|
||||
ts.isNullishCoalesce = isNullishCoalesce;
|
||||
function isNewExpression(node) {
|
||||
return node.kind === 196 /* NewExpression */;
|
||||
}
|
||||
@@ -29680,11 +29684,10 @@ var ts;
|
||||
if (!expression) {
|
||||
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
|
||||
}
|
||||
if (expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
|
||||
if (!ts.isExpressionOfOptionalChainRoot(expression)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if ((expression.kind === 105 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
|
||||
expression.kind === 90 /* FalseKeyword */ && flags & 32 /* TrueCondition */) &&
|
||||
!ts.isExpressionOfOptionalChainRoot(expression) && !ts.isNullishCoalesce(expression.parent)) {
|
||||
return unreachableFlow;
|
||||
}
|
||||
if (!isNarrowingExpression(expression)) {
|
||||
return antecedent;
|
||||
@@ -30641,7 +30644,12 @@ var ts;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
if (!ts.isExternalOrCommonJsModule(file)) {
|
||||
container = undefined;
|
||||
}
|
||||
else {
|
||||
container = file;
|
||||
}
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
@@ -30655,7 +30663,9 @@ var ts;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
if (container) {
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
}
|
||||
container = oldContainer;
|
||||
}
|
||||
}
|
||||
@@ -36532,8 +36542,6 @@ var ts;
|
||||
else if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ &&
|
||||
type.symbol.valueDeclaration &&
|
||||
ts.isClassLike(type.symbol.valueDeclaration) &&
|
||||
// Use `import` types for refs to other scopes, only anonymize something defined in the same scope
|
||||
ts.findAncestor(type.symbol.valueDeclaration, function (d) { return d === ts.getSourceFileOfNode(context.enclosingDeclaration); }) &&
|
||||
!isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
||||
return createAnonymousTypeNode(type);
|
||||
}
|
||||
@@ -42591,7 +42599,7 @@ var ts;
|
||||
/**
|
||||
* A JSdoc TypeReference may be to a value, but resolve it as a type anyway.
|
||||
* Note: If the value is imported from commonjs, it should really be an alias,
|
||||
* but this function fakes special-case code fakes alias resolution as well.
|
||||
* but this function's special-case code fakes alias resolution as well.
|
||||
*/
|
||||
function getTypeFromJSDocValueReference(node, symbol) {
|
||||
var valueType = getTypeOfSymbol(symbol);
|
||||
@@ -42603,7 +42611,9 @@ var ts;
|
||||
&& ts.isCallExpression(decl.initializer)
|
||||
&& ts.isRequireCall(decl.initializer, /*requireStringLiteralLikeArgument*/ true)
|
||||
&& valueType.symbol;
|
||||
if (isRequireAlias) {
|
||||
var isImportType = node.kind === 187 /* ImportType */;
|
||||
var isDelayedMergeClass = symbol !== valueType.symbol && getMergedSymbol(symbol) === valueType.symbol;
|
||||
if (isRequireAlias || isImportType || isDelayedMergeClass) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
@@ -45533,13 +45543,13 @@ var ts;
|
||||
// If a signature resolution is already in-flight, skip issuing a circularity error
|
||||
// here and just use the `any` type directly
|
||||
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(target.declaration.symbol)
|
||||
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
||||
: getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(source.declaration.symbol)
|
||||
: source.declaration && isJSConstructor(source.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(source.declaration.symbol))
|
||||
: getReturnTypeOfSignature(source);
|
||||
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
|
||||
var targetTypePredicate = getTypePredicateOfSignature(target);
|
||||
@@ -96111,6 +96121,16 @@ var ts;
|
||||
function findSourceFile(fileName, path, isDefaultLib, ignoreNoDefaultLib, refFile, packageId) {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
var source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
ts.isDeclarationFileName(fileName) &&
|
||||
ts.stringContains(fileName, ts.nodeModulesPathPart)) {
|
||||
// use host's cached realpath
|
||||
var realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName)
|
||||
source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
var file_1 = ts.isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
|
||||
Reference in New Issue
Block a user