@typescript-deploys/pr-build 4.7.0-pr-48264-3 → 4.7.0-pr-48294-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/protocol.d.ts +0 -4
- package/lib/tsc.js +161 -140
- package/lib/tsserver.js +259 -426
- package/lib/tsserverlibrary.d.ts +1 -10
- package/lib/tsserverlibrary.js +259 -426
- package/lib/typescript.js +255 -311
- package/lib/typescriptServices.js +255 -311
- package/lib/typingsInstaller.js +171 -163
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220316";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8034,7 +8034,7 @@ var ts;
|
|
|
8034
8034
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
8035
8035
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
8036
8036
|
A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."),
|
|
8037
|
-
|
|
8037
|
+
The_parser_expected_to_find_a_1_to_match_the_0_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_1_to_match_the_0_token_here_1007", "The parser expected to find a '{1}' to match the '{0}' token here."),
|
|
8038
8038
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
8039
8039
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
8040
8040
|
An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."),
|
|
@@ -14950,10 +14950,6 @@ var ts;
|
|
|
14950
14950
|
}
|
|
14951
14951
|
}
|
|
14952
14952
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14953
|
-
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14954
|
-
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14955
|
-
}
|
|
14956
|
-
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14957
14953
|
function isLateVisibilityPaintedStatement(node) {
|
|
14958
14954
|
switch (node.kind) {
|
|
14959
14955
|
case 265 /* ImportDeclaration */:
|
|
@@ -16532,14 +16528,14 @@ var ts;
|
|
|
16532
16528
|
}
|
|
16533
16529
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16534
16530
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16535
|
-
var _a, _b;
|
|
16531
|
+
var _a, _b, _c;
|
|
16536
16532
|
switch (node.kind) {
|
|
16537
16533
|
case 253 /* VariableDeclaration */:
|
|
16538
|
-
return
|
|
16534
|
+
return node.initializer.arguments[0].text;
|
|
16539
16535
|
case 265 /* ImportDeclaration */:
|
|
16540
|
-
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16536
|
+
return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
|
|
16541
16537
|
case 264 /* ImportEqualsDeclaration */:
|
|
16542
|
-
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16538
|
+
return (_c = ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike)) === null || _c === void 0 ? void 0 : _c.text;
|
|
16543
16539
|
default:
|
|
16544
16540
|
ts.Debug.assertNever(node);
|
|
16545
16541
|
}
|
|
@@ -17066,28 +17062,21 @@ var ts;
|
|
|
17066
17062
|
// export = <EntityNameExpression>
|
|
17067
17063
|
// export default <EntityNameExpression>
|
|
17068
17064
|
// module.exports = <EntityNameExpression>
|
|
17069
|
-
//
|
|
17070
|
-
//
|
|
17071
|
-
// const { x } = require("...")
|
|
17072
|
-
// const x = require("...").y
|
|
17073
|
-
// const { x } = require("...").y
|
|
17065
|
+
// {<Identifier>}
|
|
17066
|
+
// {name: <EntityNameExpression>}
|
|
17074
17067
|
function isAliasSymbolDeclaration(node) {
|
|
17075
|
-
|
|
17068
|
+
return node.kind === 264 /* ImportEqualsDeclaration */ ||
|
|
17076
17069
|
node.kind === 263 /* NamespaceExportDeclaration */ ||
|
|
17077
17070
|
node.kind === 266 /* ImportClause */ && !!node.name ||
|
|
17078
17071
|
node.kind === 267 /* NamespaceImport */ ||
|
|
17079
17072
|
node.kind === 273 /* NamespaceExport */ ||
|
|
17080
17073
|
node.kind === 269 /* ImportSpecifier */ ||
|
|
17081
17074
|
node.kind === 274 /* ExportSpecifier */ ||
|
|
17082
|
-
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
&& ts.isBinaryExpression(node.parent)
|
|
17088
|
-
&& node.parent.left === node
|
|
17089
|
-
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17090
|
-
&& isAliasableExpression(node.parent.right));
|
|
17075
|
+
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
|
|
17076
|
+
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17077
|
+
ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
|
|
17078
|
+
node.kind === 296 /* ShorthandPropertyAssignment */ ||
|
|
17079
|
+
node.kind === 295 /* PropertyAssignment */ && isAliasableExpression(node.initializer);
|
|
17091
17080
|
}
|
|
17092
17081
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17093
17082
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17098,7 +17087,6 @@ var ts;
|
|
|
17098
17087
|
case 274 /* ExportSpecifier */:
|
|
17099
17088
|
case 270 /* ExportAssignment */:
|
|
17100
17089
|
case 264 /* ImportEqualsDeclaration */:
|
|
17101
|
-
case 273 /* NamespaceExport */:
|
|
17102
17090
|
return node.parent;
|
|
17103
17091
|
case 160 /* QualifiedName */:
|
|
17104
17092
|
do {
|
|
@@ -31438,20 +31426,23 @@ var ts;
|
|
|
31438
31426
|
return inContext(32768 /* AwaitContext */);
|
|
31439
31427
|
}
|
|
31440
31428
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
31441
|
-
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31429
|
+
return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31442
31430
|
}
|
|
31443
31431
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
31444
31432
|
// Don't report another error if it would just be at the same position as the last error.
|
|
31445
31433
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
31434
|
+
var result;
|
|
31446
31435
|
if (!lastError || start !== lastError.start) {
|
|
31447
|
-
|
|
31436
|
+
result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
|
|
31437
|
+
parseDiagnostics.push(result);
|
|
31448
31438
|
}
|
|
31449
31439
|
// Mark that we've encountered an error. We'll set an appropriate bit on the next
|
|
31450
31440
|
// node we finish so that it can't be reused incrementally.
|
|
31451
31441
|
parseErrorBeforeNextFinishedNode = true;
|
|
31442
|
+
return result;
|
|
31452
31443
|
}
|
|
31453
31444
|
function parseErrorAt(start, end, message, arg0) {
|
|
31454
|
-
parseErrorAtPosition(start, end - start, message, arg0);
|
|
31445
|
+
return parseErrorAtPosition(start, end - start, message, arg0);
|
|
31455
31446
|
}
|
|
31456
31447
|
function parseErrorAtRange(range, message, arg0) {
|
|
31457
31448
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -31724,6 +31715,19 @@ var ts;
|
|
|
31724
31715
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
31725
31716
|
return false;
|
|
31726
31717
|
}
|
|
31718
|
+
function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
|
|
31719
|
+
if (token() === closeKind) {
|
|
31720
|
+
nextToken();
|
|
31721
|
+
return;
|
|
31722
|
+
}
|
|
31723
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
31724
|
+
if (!openParsed) {
|
|
31725
|
+
return;
|
|
31726
|
+
}
|
|
31727
|
+
if (lastError) {
|
|
31728
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind)));
|
|
31729
|
+
}
|
|
31730
|
+
}
|
|
31727
31731
|
function parseOptional(t) {
|
|
31728
31732
|
if (token() === t) {
|
|
31729
31733
|
nextToken();
|
|
@@ -33372,7 +33376,7 @@ var ts;
|
|
|
33372
33376
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
33373
33377
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
33374
33378
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
33375
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
33379
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
33376
33380
|
}
|
|
33377
33381
|
}
|
|
33378
33382
|
return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
@@ -35182,10 +35186,11 @@ var ts;
|
|
|
35182
35186
|
}
|
|
35183
35187
|
function parseArrayLiteralExpression() {
|
|
35184
35188
|
var pos = getNodePos();
|
|
35185
|
-
|
|
35189
|
+
var openBracketPosition = scanner.getTokenPos();
|
|
35190
|
+
var openBracketParsed = parseExpected(22 /* OpenBracketToken */);
|
|
35186
35191
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35187
35192
|
var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
35188
|
-
|
|
35193
|
+
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
|
|
35189
35194
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
35190
35195
|
}
|
|
35191
35196
|
function parseObjectLiteralElement() {
|
|
@@ -35242,15 +35247,10 @@ var ts;
|
|
|
35242
35247
|
function parseObjectLiteralExpression() {
|
|
35243
35248
|
var pos = getNodePos();
|
|
35244
35249
|
var openBracePosition = scanner.getTokenPos();
|
|
35245
|
-
parseExpected(18 /* OpenBraceToken */);
|
|
35250
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */);
|
|
35246
35251
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35247
35252
|
var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
|
|
35248
|
-
|
|
35249
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35250
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35251
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35252
|
-
}
|
|
35253
|
-
}
|
|
35253
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35254
35254
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
35255
35255
|
}
|
|
35256
35256
|
function parseFunctionExpression() {
|
|
@@ -35306,15 +35306,11 @@ var ts;
|
|
|
35306
35306
|
var pos = getNodePos();
|
|
35307
35307
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35308
35308
|
var openBracePosition = scanner.getTokenPos();
|
|
35309
|
-
|
|
35309
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
|
|
35310
|
+
if (openBraceParsed || ignoreMissingOpenBrace) {
|
|
35310
35311
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35311
35312
|
var statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
35312
|
-
|
|
35313
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35314
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35315
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35316
|
-
}
|
|
35317
|
-
}
|
|
35313
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35318
35314
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
35319
35315
|
if (token() === 63 /* EqualsToken */) {
|
|
35320
35316
|
parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
|
|
@@ -35359,9 +35355,10 @@ var ts;
|
|
|
35359
35355
|
var pos = getNodePos();
|
|
35360
35356
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35361
35357
|
parseExpected(99 /* IfKeyword */);
|
|
35362
|
-
|
|
35358
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35359
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35363
35360
|
var expression = allowInAnd(parseExpression);
|
|
35364
|
-
|
|
35361
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35365
35362
|
var thenStatement = parseStatement();
|
|
35366
35363
|
var elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : undefined;
|
|
35367
35364
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -35372,9 +35369,10 @@ var ts;
|
|
|
35372
35369
|
parseExpected(90 /* DoKeyword */);
|
|
35373
35370
|
var statement = parseStatement();
|
|
35374
35371
|
parseExpected(115 /* WhileKeyword */);
|
|
35375
|
-
|
|
35372
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35373
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35376
35374
|
var expression = allowInAnd(parseExpression);
|
|
35377
|
-
|
|
35375
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35378
35376
|
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
|
|
35379
35377
|
// 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
|
|
35380
35378
|
// spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
|
|
@@ -35386,9 +35384,10 @@ var ts;
|
|
|
35386
35384
|
var pos = getNodePos();
|
|
35387
35385
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35388
35386
|
parseExpected(115 /* WhileKeyword */);
|
|
35389
|
-
|
|
35387
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35388
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35390
35389
|
var expression = allowInAnd(parseExpression);
|
|
35391
|
-
|
|
35390
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35392
35391
|
var statement = parseStatement();
|
|
35393
35392
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
35394
35393
|
}
|
|
@@ -35455,9 +35454,10 @@ var ts;
|
|
|
35455
35454
|
var pos = getNodePos();
|
|
35456
35455
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35457
35456
|
parseExpected(116 /* WithKeyword */);
|
|
35458
|
-
|
|
35457
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35458
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35459
35459
|
var expression = allowInAnd(parseExpression);
|
|
35460
|
-
|
|
35460
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35461
35461
|
var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
|
|
35462
35462
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
35463
35463
|
}
|
|
@@ -36591,7 +36591,7 @@ var ts;
|
|
|
36591
36591
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
36592
36592
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
36593
36593
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
36594
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
36594
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
36595
36595
|
}
|
|
36596
36596
|
}
|
|
36597
36597
|
return finishNode(factory.createAssertClause(elements, multiLine), pos);
|
|
@@ -37567,8 +37567,7 @@ var ts;
|
|
|
37567
37567
|
hasChildren = true;
|
|
37568
37568
|
if (child.kind === 342 /* JSDocTypeTag */) {
|
|
37569
37569
|
if (childTypeTag) {
|
|
37570
|
-
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37571
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
37570
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37572
37571
|
if (lastError) {
|
|
37573
37572
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
37574
37573
|
}
|
|
@@ -39446,13 +39445,6 @@ var ts;
|
|
|
39446
39445
|
description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
|
39447
39446
|
defaultValueDescription: false,
|
|
39448
39447
|
},
|
|
39449
|
-
{
|
|
39450
|
-
name: "noDtsResolution",
|
|
39451
|
-
type: "boolean",
|
|
39452
|
-
affectsModuleResolution: true,
|
|
39453
|
-
category: ts.Diagnostics.Modules,
|
|
39454
|
-
defaultValueDescription: false,
|
|
39455
|
-
},
|
|
39456
39448
|
// Source Maps
|
|
39457
39449
|
{
|
|
39458
39450
|
name: "sourceRoot",
|
|
@@ -41832,8 +41824,7 @@ var ts;
|
|
|
41832
41824
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
41833
41825
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
41834
41826
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
41835
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
41836
|
-
Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
|
|
41827
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
|
|
41837
41828
|
})(Extensions || (Extensions = {}));
|
|
41838
41829
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
41839
41830
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -42778,21 +42769,7 @@ var ts;
|
|
|
42778
42769
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
42779
42770
|
}
|
|
42780
42771
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
42781
|
-
|
|
42782
|
-
if (lookupConfig) {
|
|
42783
|
-
extensions = tsconfigExtensions;
|
|
42784
|
-
}
|
|
42785
|
-
else if (compilerOptions.noDtsResolution) {
|
|
42786
|
-
extensions = [Extensions.TypeScriptButNotDts];
|
|
42787
|
-
if (compilerOptions.allowJs)
|
|
42788
|
-
extensions.push(Extensions.JavaScript);
|
|
42789
|
-
if (compilerOptions.resolveJsonModule)
|
|
42790
|
-
extensions.push(Extensions.Json);
|
|
42791
|
-
}
|
|
42792
|
-
else {
|
|
42793
|
-
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
42794
|
-
}
|
|
42795
|
-
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
42772
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
42796
42773
|
}
|
|
42797
42774
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
42798
42775
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -42801,10 +42778,6 @@ var ts;
|
|
|
42801
42778
|
var failedLookupLocations = [];
|
|
42802
42779
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
42803
42780
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
42804
|
-
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
42805
|
-
if (compilerOptions.noDtsResolution) {
|
|
42806
|
-
conditions.pop();
|
|
42807
|
-
}
|
|
42808
42781
|
var state = {
|
|
42809
42782
|
compilerOptions: compilerOptions,
|
|
42810
42783
|
host: host,
|
|
@@ -42812,7 +42785,7 @@ var ts;
|
|
|
42812
42785
|
failedLookupLocations: failedLookupLocations,
|
|
42813
42786
|
packageJsonInfoCache: cache,
|
|
42814
42787
|
features: features,
|
|
42815
|
-
conditions:
|
|
42788
|
+
conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
|
|
42816
42789
|
};
|
|
42817
42790
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
42818
42791
|
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
@@ -43020,22 +42993,20 @@ var ts;
|
|
|
43020
42993
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43021
42994
|
}
|
|
43022
42995
|
case Extensions.TypeScript:
|
|
43023
|
-
case Extensions.TypeScriptButNotDts:
|
|
43024
|
-
var useDts = extensions === Extensions.TypeScript;
|
|
43025
42996
|
switch (originalExtension) {
|
|
43026
42997
|
case ".mjs" /* Mjs */:
|
|
43027
42998
|
case ".mts" /* Mts */:
|
|
43028
42999
|
case ".d.mts" /* Dmts */:
|
|
43029
|
-
return tryExtension(".mts" /* Mts */) ||
|
|
43000
|
+
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43030
43001
|
case ".cjs" /* Cjs */:
|
|
43031
43002
|
case ".cts" /* Cts */:
|
|
43032
43003
|
case ".d.cts" /* Dcts */:
|
|
43033
|
-
return tryExtension(".cts" /* Cts */) ||
|
|
43004
|
+
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43034
43005
|
case ".json" /* Json */:
|
|
43035
43006
|
candidate += ".json" /* Json */;
|
|
43036
|
-
return
|
|
43007
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
43037
43008
|
default:
|
|
43038
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) ||
|
|
43009
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43039
43010
|
}
|
|
43040
43011
|
case Extensions.JavaScript:
|
|
43041
43012
|
switch (originalExtension) {
|
|
@@ -43253,7 +43224,6 @@ var ts;
|
|
|
43253
43224
|
switch (extensions) {
|
|
43254
43225
|
case Extensions.JavaScript:
|
|
43255
43226
|
case Extensions.Json:
|
|
43256
|
-
case Extensions.TypeScriptButNotDts:
|
|
43257
43227
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43258
43228
|
break;
|
|
43259
43229
|
case Extensions.TypeScript:
|
|
@@ -43332,8 +43302,6 @@ var ts;
|
|
|
43332
43302
|
return extension === ".json" /* Json */;
|
|
43333
43303
|
case Extensions.TypeScript:
|
|
43334
43304
|
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43335
|
-
case Extensions.TypeScriptButNotDts:
|
|
43336
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */;
|
|
43337
43305
|
case Extensions.DtsOnly:
|
|
43338
43306
|
return extension === ".d.ts" /* Dts */;
|
|
43339
43307
|
}
|
|
@@ -54950,7 +54918,7 @@ var ts;
|
|
|
54950
54918
|
if (!omitTypeAlias) {
|
|
54951
54919
|
return errorType;
|
|
54952
54920
|
}
|
|
54953
|
-
return
|
|
54921
|
+
return getGlobalTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54954
54922
|
}
|
|
54955
54923
|
var members = ts.createSymbolTable();
|
|
54956
54924
|
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
@@ -55402,7 +55370,7 @@ var ts;
|
|
|
55402
55370
|
}
|
|
55403
55371
|
}
|
|
55404
55372
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55405
|
-
type = getUnionType(sourceTypes);
|
|
55373
|
+
type = getUnionType(sourceTypes, 2 /* Subtype */);
|
|
55406
55374
|
}
|
|
55407
55375
|
}
|
|
55408
55376
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -56717,7 +56685,7 @@ var ts;
|
|
|
56717
56685
|
}
|
|
56718
56686
|
}
|
|
56719
56687
|
if (memberTypeList.length) {
|
|
56720
|
-
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined);
|
|
56688
|
+
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined);
|
|
56721
56689
|
if (enumType_1.flags & 1048576 /* Union */) {
|
|
56722
56690
|
enumType_1.flags |= 1024 /* EnumLiteral */;
|
|
56723
56691
|
enumType_1.symbol = symbol;
|
|
@@ -58337,8 +58305,10 @@ var ts;
|
|
|
58337
58305
|
return type;
|
|
58338
58306
|
}
|
|
58339
58307
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
58340
|
-
|
|
58341
|
-
|
|
58308
|
+
var objectType;
|
|
58309
|
+
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58310
|
+
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58311
|
+
!objectType.declaration.questionToken && !objectType.declaration.nameType);
|
|
58342
58312
|
}
|
|
58343
58313
|
/**
|
|
58344
58314
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -58926,7 +58896,19 @@ var ts;
|
|
|
58926
58896
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
58927
58897
|
});
|
|
58928
58898
|
var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
58929
|
-
|
|
58899
|
+
if (lastParamVariadicType) {
|
|
58900
|
+
// Parameter has effective annotation, lock in type
|
|
58901
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
58902
|
+
}
|
|
58903
|
+
else {
|
|
58904
|
+
// Parameter has no annotation
|
|
58905
|
+
// By using a `DeferredType` symbol, we allow the type of this rest arg to be overriden by contextual type assignment so long as its type hasn't been
|
|
58906
|
+
// cached by `getTypeOfSymbol` yet.
|
|
58907
|
+
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
58908
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
58909
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
58910
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
58911
|
+
}
|
|
58930
58912
|
if (lastParamVariadicType) {
|
|
58931
58913
|
// Replace the last parameter with a rest parameter.
|
|
58932
58914
|
parameters.pop();
|
|
@@ -59426,7 +59408,7 @@ var ts;
|
|
|
59426
59408
|
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
|
59427
59409
|
return type;
|
|
59428
59410
|
}
|
|
59429
|
-
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) {
|
|
59411
|
+
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
59430
59412
|
if (!aliasSymbol) {
|
|
59431
59413
|
aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59432
59414
|
var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
|
@@ -59438,6 +59420,7 @@ var ts;
|
|
|
59438
59420
|
type.mapper = mapper;
|
|
59439
59421
|
type.aliasSymbol = aliasSymbol;
|
|
59440
59422
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
59423
|
+
type.aliasMapper = aliasMapper;
|
|
59441
59424
|
return type;
|
|
59442
59425
|
}
|
|
59443
59426
|
function getTypeArguments(type) {
|
|
@@ -59502,7 +59485,7 @@ var ts;
|
|
|
59502
59485
|
}
|
|
59503
59486
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59504
59487
|
}
|
|
59505
|
-
function
|
|
59488
|
+
function getGlobalTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
59506
59489
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59507
59490
|
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59508
59491
|
return getStringMappingType(symbol, typeArguments[0]);
|
|
@@ -59516,6 +59499,33 @@ var ts;
|
|
|
59516
59499
|
}
|
|
59517
59500
|
return instantiation;
|
|
59518
59501
|
}
|
|
59502
|
+
function getLocalTypeAliasInstantiation(symbol, typeArguments, outerTypeParameterMapper, aliasSymbol, aliasTypeArguments) {
|
|
59503
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59504
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59505
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
59506
|
+
}
|
|
59507
|
+
var links = getSymbolLinks(symbol);
|
|
59508
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(symbol);
|
|
59509
|
+
var mappedOuterParams = outerTypeParameterMapper && outerTypeParameters && instantiateTypes(outerTypeParameters, outerTypeParameterMapper);
|
|
59510
|
+
var typeParameters = links.typeParameters;
|
|
59511
|
+
var id = getTypeListId(ts.concatenate(mappedOuterParams, typeArguments)) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59512
|
+
var instantiation = links.instantiations.get(id);
|
|
59513
|
+
if (!instantiation) {
|
|
59514
|
+
var outerTypeArgumentMapper = outerTypeParameters && mappedOuterParams && createTypeMapper(outerTypeParameters, mappedOuterParams);
|
|
59515
|
+
var argumentMapper = createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(symbol.valueDeclaration)));
|
|
59516
|
+
var combinedMapper = outerTypeArgumentMapper ? combineTypeMappers(argumentMapper, outerTypeArgumentMapper) : argumentMapper;
|
|
59517
|
+
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, combinedMapper, aliasSymbol, aliasTypeArguments));
|
|
59518
|
+
}
|
|
59519
|
+
return instantiation;
|
|
59520
|
+
}
|
|
59521
|
+
function getOuterTypeParametersOfAlias(symbol) {
|
|
59522
|
+
var _a;
|
|
59523
|
+
var links = getSymbolLinks(symbol);
|
|
59524
|
+
if (!links.outerTypeParameters) {
|
|
59525
|
+
links.outerTypeParameters = ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && getOuterTypeParameters(symbol.declarations[0], /*includeThisTypes*/ true);
|
|
59526
|
+
}
|
|
59527
|
+
return links.outerTypeParameters;
|
|
59528
|
+
}
|
|
59519
59529
|
/**
|
|
59520
59530
|
* Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
|
|
59521
59531
|
* references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
|
|
@@ -59551,7 +59561,7 @@ var ts;
|
|
|
59551
59561
|
// a .d.ts file. See #43622 for an example.
|
|
59552
59562
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59553
59563
|
var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : undefined;
|
|
59554
|
-
return
|
|
59564
|
+
return getGlobalTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
|
|
59555
59565
|
}
|
|
59556
59566
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59557
59567
|
}
|
|
@@ -60466,14 +60476,7 @@ var ts;
|
|
|
60466
60476
|
result.types = types;
|
|
60467
60477
|
return result;
|
|
60468
60478
|
}
|
|
60469
|
-
|
|
60470
|
-
// flag is specified we also reduce the constituent type set to only include types that aren't subtypes
|
|
60471
|
-
// of other types. Subtype reduction is expensive for large union types and is possible only when union
|
|
60472
|
-
// types are known not to circularly reference themselves (as is the case with union types created by
|
|
60473
|
-
// expression constructs such as array literals and the || and ?: operators). Named types can
|
|
60474
|
-
// circularly reference themselves and therefore cannot be subtype reduced during their declaration.
|
|
60475
|
-
// For example, "type Item = string | (() => Item" is a named type that circularly references itself.
|
|
60476
|
-
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) {
|
|
60479
|
+
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60477
60480
|
if (unionReduction === void 0) { unionReduction = 1 /* Literal */; }
|
|
60478
60481
|
if (types.length === 0) {
|
|
60479
60482
|
return neverType;
|
|
@@ -60542,7 +60545,7 @@ var ts;
|
|
|
60542
60545
|
}
|
|
60543
60546
|
var objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
|
|
60544
60547
|
(includes & 2097152 /* Intersection */ ? 33554432 /* ContainsIntersections */ : 0);
|
|
60545
|
-
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60548
|
+
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
60546
60549
|
}
|
|
60547
60550
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
60548
60551
|
var first;
|
|
@@ -60580,7 +60583,7 @@ var ts;
|
|
|
60580
60583
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
60581
60584
|
}
|
|
60582
60585
|
// This function assumes the constituent type list is sorted and deduplicated.
|
|
60583
|
-
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
60586
|
+
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60584
60587
|
if (types.length === 0) {
|
|
60585
60588
|
return neverType;
|
|
60586
60589
|
}
|
|
@@ -60600,6 +60603,7 @@ var ts;
|
|
|
60600
60603
|
type.origin = origin;
|
|
60601
60604
|
type.aliasSymbol = aliasSymbol;
|
|
60602
60605
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
60606
|
+
type.aliasMapper = aliasMapper;
|
|
60603
60607
|
if (types.length === 2 && types[0].flags & 512 /* BooleanLiteral */ && types[1].flags & 512 /* BooleanLiteral */) {
|
|
60604
60608
|
type.flags |= 16 /* Boolean */;
|
|
60605
60609
|
type.intrinsicName = "boolean";
|
|
@@ -60612,7 +60616,7 @@ var ts;
|
|
|
60612
60616
|
var links = getNodeLinks(node);
|
|
60613
60617
|
if (!links.resolvedType) {
|
|
60614
60618
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60615
|
-
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
60619
|
+
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
60616
60620
|
}
|
|
60617
60621
|
return links.resolvedType;
|
|
60618
60622
|
}
|
|
@@ -60771,25 +60775,16 @@ var ts;
|
|
|
60771
60775
|
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
|
|
60772
60776
|
return true;
|
|
60773
60777
|
}
|
|
60774
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60778
|
+
function createIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60775
60779
|
var result = createType(2097152 /* Intersection */);
|
|
60776
60780
|
result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
|
|
60777
60781
|
result.types = types;
|
|
60778
60782
|
result.aliasSymbol = aliasSymbol;
|
|
60779
60783
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
60784
|
+
result.aliasMapper = aliasMapper;
|
|
60780
60785
|
return result;
|
|
60781
60786
|
}
|
|
60782
|
-
|
|
60783
|
-
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
|
|
60784
|
-
// types with union type constituents into equivalent union types with intersection type constituents and
|
|
60785
|
-
// effectively ensure that union types are always at the top level in type representations.
|
|
60786
|
-
//
|
|
60787
|
-
// We do not perform structural deduplication on intersection types. Intersection types are created only by the &
|
|
60788
|
-
// type operator and we can't reduce those because we want to support recursive intersection types. For example,
|
|
60789
|
-
// a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
|
|
60790
|
-
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
|
|
60791
|
-
// for intersections of types with signatures can be deterministic.
|
|
60792
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60787
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60793
60788
|
var typeMembershipMap = new ts.Map();
|
|
60794
60789
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
60795
60790
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -60849,16 +60844,16 @@ var ts;
|
|
|
60849
60844
|
// When the intersection creates a reduced set (which might mean that *all* union types have
|
|
60850
60845
|
// disappeared), we restart the operation to get a new set of combined flags. Once we have
|
|
60851
60846
|
// reduced we'll never reduce again, so this occurs at most once.
|
|
60852
|
-
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
60847
|
+
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60853
60848
|
}
|
|
60854
60849
|
else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
60855
60850
|
var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
|
|
60856
60851
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
60857
|
-
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60852
|
+
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60858
60853
|
}
|
|
60859
60854
|
else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
60860
60855
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60861
|
-
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60856
|
+
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60862
60857
|
}
|
|
60863
60858
|
else {
|
|
60864
60859
|
// We are attempting to construct a type of the form X & (A | B) & (C | D). Transform this into a type of
|
|
@@ -60871,7 +60866,7 @@ var ts;
|
|
|
60871
60866
|
// We attach a denormalized origin type when at least one constituent of the cross-product union is an
|
|
60872
60867
|
// intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
|
|
60873
60868
|
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
|
|
60874
|
-
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
60869
|
+
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
60875
60870
|
}
|
|
60876
60871
|
}
|
|
60877
60872
|
else {
|
|
@@ -60917,7 +60912,7 @@ var ts;
|
|
|
60917
60912
|
var links = getNodeLinks(node);
|
|
60918
60913
|
if (!links.resolvedType) {
|
|
60919
60914
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60920
|
-
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
60915
|
+
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
60921
60916
|
}
|
|
60922
60917
|
return links.resolvedType;
|
|
60923
60918
|
}
|
|
@@ -61036,7 +61031,7 @@ var ts;
|
|
|
61036
61031
|
var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
|
|
61037
61032
|
info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; });
|
|
61038
61033
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
|
|
61039
|
-
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
|
|
61034
|
+
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, origin);
|
|
61040
61035
|
}
|
|
61041
61036
|
/**
|
|
61042
61037
|
* A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
|
|
@@ -61069,7 +61064,7 @@ var ts;
|
|
|
61069
61064
|
return type;
|
|
61070
61065
|
}
|
|
61071
61066
|
var extractTypeAlias = getGlobalExtractSymbol();
|
|
61072
|
-
return extractTypeAlias ?
|
|
61067
|
+
return extractTypeAlias ? getGlobalTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
|
|
61073
61068
|
}
|
|
61074
61069
|
function getIndexTypeOrString(type) {
|
|
61075
61070
|
var indexType = getExtractStringType(getIndexType(type));
|
|
@@ -61199,13 +61194,14 @@ var ts;
|
|
|
61199
61194
|
result.type = type;
|
|
61200
61195
|
return result;
|
|
61201
61196
|
}
|
|
61202
|
-
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
61197
|
+
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61203
61198
|
var type = createType(8388608 /* IndexedAccess */);
|
|
61204
61199
|
type.objectType = objectType;
|
|
61205
61200
|
type.indexType = indexType;
|
|
61206
61201
|
type.accessFlags = accessFlags;
|
|
61207
61202
|
type.aliasSymbol = aliasSymbol;
|
|
61208
61203
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
61204
|
+
type.aliasMapper = aliasMapper;
|
|
61209
61205
|
return type;
|
|
61210
61206
|
}
|
|
61211
61207
|
/**
|
|
@@ -61523,7 +61519,7 @@ var ts;
|
|
|
61523
61519
|
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
|
61524
61520
|
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
|
61525
61521
|
// construct the type Box<T[X]>.
|
|
61526
|
-
if (isGenericMappedType(objectType)) {
|
|
61522
|
+
if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
|
|
61527
61523
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61528
61524
|
}
|
|
61529
61525
|
return type[cache] = type;
|
|
@@ -61563,9 +61559,9 @@ var ts;
|
|
|
61563
61559
|
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
61564
61560
|
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
|
61565
61561
|
}
|
|
61566
|
-
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61562
|
+
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61567
61563
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61568
|
-
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
61564
|
+
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) || (accessNode ? errorType : unknownType);
|
|
61569
61565
|
}
|
|
61570
61566
|
function indexTypeLessThan(indexType, limit) {
|
|
61571
61567
|
return everyType(indexType, function (t) {
|
|
@@ -61579,7 +61575,7 @@ var ts;
|
|
|
61579
61575
|
return false;
|
|
61580
61576
|
});
|
|
61581
61577
|
}
|
|
61582
|
-
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61578
|
+
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61583
61579
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61584
61580
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
61585
61581
|
return wildcardType;
|
|
@@ -61610,7 +61606,7 @@ var ts;
|
|
|
61610
61606
|
var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
61611
61607
|
var type = indexedAccessTypes.get(id);
|
|
61612
61608
|
if (!type) {
|
|
61613
|
-
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments));
|
|
61609
|
+
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments, aliasMapper));
|
|
61614
61610
|
}
|
|
61615
61611
|
return type;
|
|
61616
61612
|
}
|
|
@@ -61640,8 +61636,8 @@ var ts;
|
|
|
61640
61636
|
return undefined;
|
|
61641
61637
|
}
|
|
61642
61638
|
return accessFlags & 4 /* Writing */
|
|
61643
|
-
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments)
|
|
61644
|
-
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61639
|
+
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments, aliasMapper)
|
|
61640
|
+
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61645
61641
|
}
|
|
61646
61642
|
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
61647
61643
|
}
|
|
@@ -61651,7 +61647,7 @@ var ts;
|
|
|
61651
61647
|
var objectType = getTypeFromTypeNode(node.objectType);
|
|
61652
61648
|
var indexType = getTypeFromTypeNode(node.indexType);
|
|
61653
61649
|
var potentialAlias = getAliasSymbolForTypeNode(node);
|
|
61654
|
-
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
|
|
61650
|
+
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias), /*aliasMapper*/ undefined);
|
|
61655
61651
|
links.resolvedType = resolved.flags & 8388608 /* IndexedAccess */ &&
|
|
61656
61652
|
resolved.objectType === objectType &&
|
|
61657
61653
|
resolved.indexType === indexType ?
|
|
@@ -61818,6 +61814,7 @@ var ts;
|
|
|
61818
61814
|
result.combinedMapper = combinedMapper;
|
|
61819
61815
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
61820
61816
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
61817
|
+
result.aliasMapper = result.aliasSymbol ? mapper : undefined;
|
|
61821
61818
|
return "break";
|
|
61822
61819
|
};
|
|
61823
61820
|
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
@@ -62613,7 +62610,7 @@ var ts;
|
|
|
62613
62610
|
var result = target.instantiations.get(id);
|
|
62614
62611
|
if (!result) {
|
|
62615
62612
|
var newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62616
|
-
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62613
|
+
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
62617
62614
|
target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62618
62615
|
instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
62619
62616
|
target.instantiations.set(id, result);
|
|
@@ -62702,7 +62699,7 @@ var ts;
|
|
|
62702
62699
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
62703
62700
|
}
|
|
62704
62701
|
return t;
|
|
62705
|
-
}, aliasSymbol, aliasTypeArguments);
|
|
62702
|
+
}, aliasSymbol, aliasTypeArguments, mapper);
|
|
62706
62703
|
}
|
|
62707
62704
|
}
|
|
62708
62705
|
// If the constraint type of the instantiation is the wildcard type, return the wildcard type.
|
|
@@ -62771,6 +62768,7 @@ var ts;
|
|
|
62771
62768
|
result.mapper = mapper;
|
|
62772
62769
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62773
62770
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62771
|
+
result.aliasMapper = mapper;
|
|
62774
62772
|
return result;
|
|
62775
62773
|
}
|
|
62776
62774
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -62790,7 +62788,7 @@ var ts;
|
|
|
62790
62788
|
// distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
|
|
62791
62789
|
// result is (A extends U ? X : Y) | (B extends U ? X : Y).
|
|
62792
62790
|
result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
|
|
62793
|
-
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
|
|
62791
|
+
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments, mapper) :
|
|
62794
62792
|
getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
|
|
62795
62793
|
root.instantiations.set(id, result);
|
|
62796
62794
|
}
|
|
@@ -62850,8 +62848,8 @@ var ts;
|
|
|
62850
62848
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62851
62849
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62852
62850
|
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ?
|
|
62853
|
-
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
|
|
62854
|
-
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
62851
|
+
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
62852
|
+
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
62855
62853
|
}
|
|
62856
62854
|
if (flags & 4194304 /* Index */) {
|
|
62857
62855
|
return getIndexType(instantiateType(type.type, mapper));
|
|
@@ -62865,7 +62863,7 @@ var ts;
|
|
|
62865
62863
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
62866
62864
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62867
62865
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62868
|
-
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
|
|
62866
|
+
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
62869
62867
|
}
|
|
62870
62868
|
if (flags & 16777216 /* Conditional */) {
|
|
62871
62869
|
return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
|
|
@@ -63596,7 +63594,7 @@ var ts;
|
|
|
63596
63594
|
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
|
63597
63595
|
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
|
63598
63596
|
: getReturnTypeOfSignature(target);
|
|
63599
|
-
if (targetReturnType === voidType) {
|
|
63597
|
+
if (targetReturnType === voidType || targetReturnType === anyType) {
|
|
63600
63598
|
return result;
|
|
63601
63599
|
}
|
|
63602
63600
|
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
|
@@ -64859,7 +64857,10 @@ var ts;
|
|
|
64859
64857
|
if (variances === ts.emptyArray) {
|
|
64860
64858
|
return 1 /* Unknown */;
|
|
64861
64859
|
}
|
|
64862
|
-
var
|
|
64860
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(source.aliasSymbol);
|
|
64861
|
+
var sourceArgs = outerTypeParameters && source.aliasMapper ? ts.concatenate(source.aliasTypeArguments, instantiateTypes(outerTypeParameters, source.aliasMapper)) : source.aliasTypeArguments;
|
|
64862
|
+
var targetArgs = outerTypeParameters && target.aliasMapper ? ts.concatenate(target.aliasTypeArguments, instantiateTypes(outerTypeParameters, target.aliasMapper)) : target.aliasTypeArguments;
|
|
64863
|
+
var varianceResult = relateVariances(sourceArgs, targetArgs, variances, intersectionState);
|
|
64863
64864
|
if (varianceResult !== undefined) {
|
|
64864
64865
|
return varianceResult;
|
|
64865
64866
|
}
|
|
@@ -66148,8 +66149,11 @@ var ts;
|
|
|
66148
66149
|
}
|
|
66149
66150
|
function getAliasVariances(symbol) {
|
|
66150
66151
|
var links = getSymbolLinks(symbol);
|
|
66151
|
-
|
|
66152
|
-
|
|
66152
|
+
// outer type parameter aliases are last so they can be easily ignored by, eg, inference
|
|
66153
|
+
var params = ts.concatenate(links.typeParameters, getOuterTypeParametersOfAlias(symbol));
|
|
66154
|
+
return getVariancesWorker(params, links, function (_links, param, marker) {
|
|
66155
|
+
var mapper = makeUnaryTypeMapper(param, marker);
|
|
66156
|
+
var type = getLocalTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, mapper), mapper);
|
|
66153
66157
|
type.aliasTypeArgumentsContainsMarker = true;
|
|
66154
66158
|
return type;
|
|
66155
66159
|
});
|
|
@@ -66806,7 +66810,7 @@ var ts;
|
|
|
66806
66810
|
}
|
|
66807
66811
|
// If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
|
|
66808
66812
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
66809
|
-
|
|
66813
|
+
getGlobalTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
66810
66814
|
reducedType;
|
|
66811
66815
|
}
|
|
66812
66816
|
function getNonNullableType(type) {
|
|
@@ -69032,7 +69036,7 @@ var ts;
|
|
|
69032
69036
|
newOrigin = createOriginUnionOrIntersectionType(1048576 /* Union */, originFiltered);
|
|
69033
69037
|
}
|
|
69034
69038
|
}
|
|
69035
|
-
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, newOrigin);
|
|
69039
|
+
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, newOrigin);
|
|
69036
69040
|
}
|
|
69037
69041
|
return type.flags & 131072 /* Never */ || f(type) ? type : neverType;
|
|
69038
69042
|
}
|
|
@@ -69068,9 +69072,9 @@ var ts;
|
|
|
69068
69072
|
}
|
|
69069
69073
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
|
69070
69074
|
}
|
|
69071
|
-
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
69075
|
+
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
69072
69076
|
return type.flags & 1048576 /* Union */ && aliasSymbol ?
|
|
69073
|
-
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) :
|
|
69077
|
+
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper) :
|
|
69074
69078
|
mapType(type, mapper);
|
|
69075
69079
|
}
|
|
69076
69080
|
function extractTypesOfKind(type, kind) {
|
|
@@ -71885,7 +71889,7 @@ var ts;
|
|
|
71885
71889
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
71886
71890
|
return mapType(type, function (t) {
|
|
71887
71891
|
var _a;
|
|
71888
|
-
if (isGenericMappedType(t)) {
|
|
71892
|
+
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
71889
71893
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
71890
71894
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
71891
71895
|
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
@@ -72255,7 +72259,7 @@ var ts;
|
|
|
72255
72259
|
var params = getSymbolLinks(managedSym).typeParameters;
|
|
72256
72260
|
if (ts.length(params) >= 2) {
|
|
72257
72261
|
var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts.isInJSFile(context));
|
|
72258
|
-
return
|
|
72262
|
+
return getGlobalTypeAliasInstantiation(managedSym, args);
|
|
72259
72263
|
}
|
|
72260
72264
|
}
|
|
72261
72265
|
if (ts.length(declaredManagedType.typeParameters) >= 2) {
|
|
@@ -76813,7 +76817,11 @@ var ts;
|
|
|
76813
76817
|
if (signatureHasRestParameter(signature)) {
|
|
76814
76818
|
// parameter might be a transient symbol generated by use of `arguments` in the function body.
|
|
76815
76819
|
var parameter = ts.last(signature.parameters);
|
|
76816
|
-
if (
|
|
76820
|
+
if (parameter.valueDeclaration
|
|
76821
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
76822
|
+
// a declarationless parameter may still have a `.type` already set by its construction logic
|
|
76823
|
+
// (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
|
|
76824
|
+
: !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
|
|
76817
76825
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
76818
76826
|
assignParameterType(parameter, contextualParameterType);
|
|
76819
76827
|
}
|
|
@@ -76832,8 +76840,8 @@ var ts;
|
|
|
76832
76840
|
var links = getSymbolLinks(parameter);
|
|
76833
76841
|
if (!links.type) {
|
|
76834
76842
|
var declaration = parameter.valueDeclaration;
|
|
76835
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
76836
|
-
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
76843
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
|
|
76844
|
+
if (declaration && declaration.name.kind !== 79 /* Identifier */) {
|
|
76837
76845
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
76838
76846
|
if (links.type === unknownType) {
|
|
76839
76847
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
@@ -80395,7 +80403,7 @@ var ts;
|
|
|
80395
80403
|
if (awaitedSymbol) {
|
|
80396
80404
|
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
80397
80405
|
// an `Awaited<T | U>` would suffice.
|
|
80398
|
-
return
|
|
80406
|
+
return getGlobalTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
80399
80407
|
}
|
|
80400
80408
|
}
|
|
80401
80409
|
}
|
|
@@ -127029,20 +127037,6 @@ var ts;
|
|
|
127029
127037
|
return !!location.parent && ts.isImportOrExportSpecifier(location.parent) && location.parent.propertyName === location;
|
|
127030
127038
|
}
|
|
127031
127039
|
ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
|
|
127032
|
-
/**
|
|
127033
|
-
* Returns true if `node` is the declaration of `n` in:
|
|
127034
|
-
* - `import n from "m"`
|
|
127035
|
-
* - `import * as n from "m"`
|
|
127036
|
-
* - `import n = require("m")`
|
|
127037
|
-
* - `const n = require("m")`
|
|
127038
|
-
*/
|
|
127039
|
-
function isFreelyNameableImport(node) {
|
|
127040
|
-
return node.kind === 266 /* ImportClause */
|
|
127041
|
-
|| node.kind === 267 /* NamespaceImport */
|
|
127042
|
-
|| ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
|
|
127043
|
-
|| ts.isVariableDeclarationInitializedToRequire(node);
|
|
127044
|
-
}
|
|
127045
|
-
ts.isFreelyNameableImport = isFreelyNameableImport;
|
|
127046
127040
|
function getScriptKind(fileName, host) {
|
|
127047
127041
|
// First check to see if the script kind was specified by the host. Chances are the host
|
|
127048
127042
|
// may override the default script kind for the file extension.
|
|
@@ -136057,29 +136051,6 @@ var ts;
|
|
|
136057
136051
|
}
|
|
136058
136052
|
}
|
|
136059
136053
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
136060
|
-
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
136061
|
-
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
136062
|
-
return candidates.reduce(function (topMost, decl) {
|
|
136063
|
-
var depth = getDepth(decl);
|
|
136064
|
-
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
136065
|
-
topMost.declarationNames.push(decl);
|
|
136066
|
-
}
|
|
136067
|
-
else if (depth < topMost.depth) {
|
|
136068
|
-
topMost.declarationNames = [decl];
|
|
136069
|
-
}
|
|
136070
|
-
topMost.depth = depth;
|
|
136071
|
-
return topMost;
|
|
136072
|
-
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
136073
|
-
function getDepth(declaration) {
|
|
136074
|
-
var depth = 0;
|
|
136075
|
-
while (declaration) {
|
|
136076
|
-
declaration = ts.getContainerNode(declaration);
|
|
136077
|
-
depth++;
|
|
136078
|
-
}
|
|
136079
|
-
return depth;
|
|
136080
|
-
}
|
|
136081
|
-
}
|
|
136082
|
-
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
136083
136054
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
136084
136055
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
136085
136056
|
return false;
|
|
@@ -137712,9 +137683,7 @@ var ts;
|
|
|
137712
137683
|
(function (ts) {
|
|
137713
137684
|
var GoToDefinition;
|
|
137714
137685
|
(function (GoToDefinition) {
|
|
137715
|
-
function getDefinitionAtPosition(program, sourceFile, position
|
|
137716
|
-
var _a;
|
|
137717
|
-
var _b;
|
|
137686
|
+
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
137718
137687
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
137719
137688
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
137720
137689
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -137737,50 +137706,17 @@ var ts;
|
|
|
137737
137706
|
}
|
|
137738
137707
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
137739
137708
|
var classDecl = node.parent.parent;
|
|
137740
|
-
var
|
|
137741
|
-
if (aliasesOnly && !isAliasTarget_1)
|
|
137742
|
-
return undefined;
|
|
137709
|
+
var symbol_1 = getSymbol(classDecl, typeChecker);
|
|
137743
137710
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
137744
137711
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
137745
137712
|
var sourceFile_1 = node.getSourceFile();
|
|
137746
137713
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
137747
137714
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
137748
137715
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
137749
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1,
|
|
137716
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
137750
137717
|
});
|
|
137751
137718
|
}
|
|
137752
|
-
var
|
|
137753
|
-
var fallbackNode = node;
|
|
137754
|
-
if (aliasesOnly && failedAliasResolution) {
|
|
137755
|
-
// We couldn't resolve the specific import, try on the module specifier.
|
|
137756
|
-
var importDeclaration = ts.findAncestor(node, ts.isAnyImportOrBareOrAccessedRequire);
|
|
137757
|
-
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
137758
|
-
if (moduleSpecifier) {
|
|
137759
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, isAliasTarget = _a.isAliasTarget, failedAliasResolution = _a.failedAliasResolution);
|
|
137760
|
-
fallbackNode = moduleSpecifier;
|
|
137761
|
-
}
|
|
137762
|
-
}
|
|
137763
|
-
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
137764
|
-
// We couldn't resolve the module specifier as an external module, but it could
|
|
137765
|
-
// be that module resolution succeeded but the target was not a module.
|
|
137766
|
-
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
137767
|
-
if (ref) {
|
|
137768
|
-
return [{
|
|
137769
|
-
name: fallbackNode.text,
|
|
137770
|
-
fileName: ref.resolvedFileName,
|
|
137771
|
-
containerName: undefined,
|
|
137772
|
-
containerKind: undefined,
|
|
137773
|
-
kind: "script" /* scriptElement */,
|
|
137774
|
-
textSpan: ts.createTextSpan(0, 0),
|
|
137775
|
-
isAliasTarget: true,
|
|
137776
|
-
failedAliasResolution: failedAliasResolution,
|
|
137777
|
-
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
137778
|
-
unverified: fallbackNode !== node,
|
|
137779
|
-
}];
|
|
137780
|
-
}
|
|
137781
|
-
}
|
|
137782
|
-
if (aliasesOnly && !isAliasTarget)
|
|
137783
|
-
return undefined;
|
|
137719
|
+
var symbol = getSymbol(node, typeChecker);
|
|
137784
137720
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
137785
137721
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
137786
137722
|
if (!symbol) {
|
|
@@ -137789,14 +137725,14 @@ var ts;
|
|
|
137789
137725
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
137790
137726
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
137791
137727
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
137792
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration
|
|
137728
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
137793
137729
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
137794
137730
|
// If this is the original constructor definition, parent is the class.
|
|
137795
137731
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
137796
137732
|
return [sigInfo];
|
|
137797
137733
|
}
|
|
137798
137734
|
else {
|
|
137799
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
137735
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
137800
137736
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
137801
137737
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
137802
137738
|
}
|
|
@@ -137808,7 +137744,7 @@ var ts;
|
|
|
137808
137744
|
// assignment. This case and others are handled by the following code.
|
|
137809
137745
|
if (node.parent.kind === 296 /* ShorthandPropertyAssignment */) {
|
|
137810
137746
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
137811
|
-
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node
|
|
137747
|
+
var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : ts.emptyArray;
|
|
137812
137748
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
137813
137749
|
}
|
|
137814
137750
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -137831,7 +137767,7 @@ var ts;
|
|
|
137831
137767
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
137832
137768
|
});
|
|
137833
137769
|
}
|
|
137834
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node
|
|
137770
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
137835
137771
|
}
|
|
137836
137772
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
137837
137773
|
/**
|
|
@@ -137929,24 +137865,24 @@ var ts;
|
|
|
137929
137865
|
return undefined;
|
|
137930
137866
|
}
|
|
137931
137867
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
137932
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent
|
|
137868
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
137933
137869
|
}
|
|
137934
|
-
var
|
|
137870
|
+
var symbol = getSymbol(node, typeChecker);
|
|
137935
137871
|
if (!symbol)
|
|
137936
137872
|
return undefined;
|
|
137937
137873
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
137938
137874
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
137939
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node
|
|
137875
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
137940
137876
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
137941
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node
|
|
137877
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
137942
137878
|
return typeDefinitions.length ? typeDefinitions
|
|
137943
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node
|
|
137879
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
137944
137880
|
: undefined;
|
|
137945
137881
|
}
|
|
137946
137882
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
137947
|
-
function definitionFromType(type, checker, node
|
|
137883
|
+
function definitionFromType(type, checker, node) {
|
|
137948
137884
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
137949
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node
|
|
137885
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
137950
137886
|
});
|
|
137951
137887
|
}
|
|
137952
137888
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -137961,8 +137897,8 @@ var ts;
|
|
|
137961
137897
|
}
|
|
137962
137898
|
return undefined;
|
|
137963
137899
|
}
|
|
137964
|
-
function getDefinitionAndBoundSpan(program, sourceFile, position
|
|
137965
|
-
var definitions = getDefinitionAtPosition(program, sourceFile, position
|
|
137900
|
+
function getDefinitionAndBoundSpan(program, sourceFile, position) {
|
|
137901
|
+
var definitions = getDefinitionAtPosition(program, sourceFile, position);
|
|
137966
137902
|
if (!definitions || definitions.length === 0) {
|
|
137967
137903
|
return undefined;
|
|
137968
137904
|
}
|
|
@@ -137988,17 +137924,13 @@ var ts;
|
|
|
137988
137924
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
137989
137925
|
// import {A, B} from "mod";
|
|
137990
137926
|
// to jump to the implementation directly.
|
|
137991
|
-
var failedAliasResolution = false;
|
|
137992
137927
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
137993
137928
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
137994
137929
|
if (aliased.declarations) {
|
|
137995
|
-
return
|
|
137996
|
-
}
|
|
137997
|
-
else {
|
|
137998
|
-
failedAliasResolution = true;
|
|
137930
|
+
return aliased;
|
|
137999
137931
|
}
|
|
138000
137932
|
}
|
|
138001
|
-
return
|
|
137933
|
+
return symbol;
|
|
138002
137934
|
}
|
|
138003
137935
|
// Go to the original declaration for cases:
|
|
138004
137936
|
//
|
|
@@ -138012,45 +137944,26 @@ var ts;
|
|
|
138012
137944
|
if (node.parent === declaration) {
|
|
138013
137945
|
return true;
|
|
138014
137946
|
}
|
|
138015
|
-
|
|
138016
|
-
|
|
138017
|
-
|
|
138018
|
-
return true;
|
|
138019
|
-
}
|
|
138020
|
-
/**
|
|
138021
|
-
* ```ts
|
|
138022
|
-
* function f() {}
|
|
138023
|
-
* f.foo = 0;
|
|
138024
|
-
* ```
|
|
138025
|
-
*
|
|
138026
|
-
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
138027
|
-
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
138028
|
-
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
138029
|
-
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
138030
|
-
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
138031
|
-
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
138032
|
-
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
138033
|
-
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
138034
|
-
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
138035
|
-
* up with a more precise definition of what counts as a definition.
|
|
138036
|
-
*/
|
|
138037
|
-
function isExpandoDeclaration(node) {
|
|
138038
|
-
if (!ts.isAssignmentDeclaration(node))
|
|
138039
|
-
return false;
|
|
138040
|
-
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
138041
|
-
if (ts.isAssignmentExpression(p))
|
|
137947
|
+
switch (declaration.kind) {
|
|
137948
|
+
case 266 /* ImportClause */:
|
|
137949
|
+
case 264 /* ImportEqualsDeclaration */:
|
|
138042
137950
|
return true;
|
|
138043
|
-
|
|
138044
|
-
return
|
|
138045
|
-
|
|
138046
|
-
|
|
138047
|
-
|
|
137951
|
+
case 269 /* ImportSpecifier */:
|
|
137952
|
+
return declaration.parent.kind === 268 /* NamedImports */;
|
|
137953
|
+
case 202 /* BindingElement */:
|
|
137954
|
+
case 253 /* VariableDeclaration */:
|
|
137955
|
+
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
137956
|
+
default:
|
|
137957
|
+
return false;
|
|
137958
|
+
}
|
|
138048
137959
|
}
|
|
138049
|
-
function getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
138050
|
-
|
|
138051
|
-
|
|
138052
|
-
|
|
138053
|
-
|
|
137960
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, declarationNode) {
|
|
137961
|
+
// There are cases when you extend a function by adding properties to it afterwards,
|
|
137962
|
+
// we want to strip those extra properties.
|
|
137963
|
+
// For deduping purposes, we also want to exclude any declarationNodes if provided.
|
|
137964
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== declarationNode && (!ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration); })
|
|
137965
|
+
|| undefined;
|
|
137966
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
|
|
138054
137967
|
function getConstructSignatureDefinition() {
|
|
138055
137968
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
138056
137969
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -138074,27 +137987,26 @@ var ts;
|
|
|
138074
137987
|
return declarations.length
|
|
138075
137988
|
? declarationsWithBody.length !== 0
|
|
138076
137989
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
138077
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node
|
|
137990
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
138078
137991
|
: undefined;
|
|
138079
137992
|
}
|
|
138080
137993
|
}
|
|
138081
137994
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
138082
|
-
function createDefinitionInfo(declaration, checker, symbol, node
|
|
137995
|
+
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
138083
137996
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
138084
137997
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
138085
137998
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
138086
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName
|
|
137999
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
138087
138000
|
}
|
|
138088
|
-
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
138089
138001
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
138090
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName,
|
|
138002
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
138091
138003
|
var sourceFile = declaration.getSourceFile();
|
|
138092
138004
|
if (!textSpan) {
|
|
138093
138005
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
138094
138006
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
138095
138007
|
}
|
|
138096
138008
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
138097
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration)
|
|
138009
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
138098
138010
|
}
|
|
138099
138011
|
function isDefinitionVisible(checker, declaration) {
|
|
138100
138012
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -138127,8 +138039,8 @@ var ts;
|
|
|
138127
138039
|
return false;
|
|
138128
138040
|
}
|
|
138129
138041
|
}
|
|
138130
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl
|
|
138131
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl
|
|
138042
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
138043
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
138132
138044
|
}
|
|
138133
138045
|
function findReferenceInPosition(refs, pos) {
|
|
138134
138046
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -138143,7 +138055,6 @@ var ts;
|
|
|
138143
138055
|
containerName: undefined,
|
|
138144
138056
|
containerKind: undefined,
|
|
138145
138057
|
unverified: unverified,
|
|
138146
|
-
isAliasTarget: true,
|
|
138147
138058
|
};
|
|
138148
138059
|
}
|
|
138149
138060
|
/** Returns a CallLikeExpression where `node` is the target being invoked. */
|
|
@@ -141197,6 +141108,41 @@ var ts;
|
|
|
141197
141108
|
if (ts.scanner.getToken() === 1 /* EndOfFileToken */) {
|
|
141198
141109
|
break;
|
|
141199
141110
|
}
|
|
141111
|
+
if (ts.scanner.getToken() === 15 /* TemplateHead */) {
|
|
141112
|
+
var stack = [ts.scanner.getToken()];
|
|
141113
|
+
var token = ts.scanner.scan();
|
|
141114
|
+
loop: while (ts.length(stack)) {
|
|
141115
|
+
switch (token) {
|
|
141116
|
+
case 1 /* EndOfFileToken */:
|
|
141117
|
+
break loop;
|
|
141118
|
+
case 100 /* ImportKeyword */:
|
|
141119
|
+
tryConsumeImport();
|
|
141120
|
+
break;
|
|
141121
|
+
case 15 /* TemplateHead */:
|
|
141122
|
+
stack.push(token);
|
|
141123
|
+
break;
|
|
141124
|
+
case 18 /* OpenBraceToken */:
|
|
141125
|
+
if (ts.length(stack)) {
|
|
141126
|
+
stack.push(token);
|
|
141127
|
+
}
|
|
141128
|
+
break;
|
|
141129
|
+
case 19 /* CloseBraceToken */:
|
|
141130
|
+
if (ts.length(stack)) {
|
|
141131
|
+
if (ts.lastOrUndefined(stack) === 15 /* TemplateHead */) {
|
|
141132
|
+
if (ts.scanner.reScanTemplateToken(/* isTaggedTemplate */ false) === 17 /* TemplateTail */) {
|
|
141133
|
+
stack.pop();
|
|
141134
|
+
}
|
|
141135
|
+
}
|
|
141136
|
+
else {
|
|
141137
|
+
stack.pop();
|
|
141138
|
+
}
|
|
141139
|
+
}
|
|
141140
|
+
break;
|
|
141141
|
+
}
|
|
141142
|
+
token = ts.scanner.scan();
|
|
141143
|
+
}
|
|
141144
|
+
nextToken();
|
|
141145
|
+
}
|
|
141200
141146
|
// check if at least one of alternative have moved scanner forward
|
|
141201
141147
|
if (tryConsumeDeclare() ||
|
|
141202
141148
|
tryConsumeImport() ||
|
|
@@ -142490,7 +142436,7 @@ var ts;
|
|
|
142490
142436
|
if (!typeDisplayString) {
|
|
142491
142437
|
continue;
|
|
142492
142438
|
}
|
|
142493
|
-
addTypeHints(typeDisplayString, param.name.end);
|
|
142439
|
+
addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
|
|
142494
142440
|
}
|
|
142495
142441
|
}
|
|
142496
142442
|
function getParameterDeclarationTypeDisplayString(symbol) {
|
|
@@ -151142,10 +151088,9 @@ var ts;
|
|
|
151142
151088
|
// 2. add "member3" to the second import statement's import list
|
|
151143
151089
|
// and it is up to the user to decide which one fits best.
|
|
151144
151090
|
return ts.firstDefined(existingImports, function (_a) {
|
|
151145
|
-
var _b;
|
|
151146
151091
|
var declaration = _a.declaration;
|
|
151147
151092
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
151148
|
-
var moduleSpecifier =
|
|
151093
|
+
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
151149
151094
|
if (namespacePrefix && moduleSpecifier) {
|
|
151150
151095
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
151151
151096
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -151321,9 +151266,8 @@ var ts;
|
|
|
151321
151266
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
151322
151267
|
}
|
|
151323
151268
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
151324
|
-
var _b;
|
|
151325
151269
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
151326
|
-
var moduleSpecifier =
|
|
151270
|
+
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
151327
151271
|
if (moduleSpecifier) {
|
|
151328
151272
|
var addAsTypeOnly = useRequire
|
|
151329
151273
|
? 4 /* NotAllowed */
|
|
@@ -163132,9 +163076,9 @@ var ts;
|
|
|
163132
163076
|
synchronizeHostData();
|
|
163133
163077
|
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
163134
163078
|
}
|
|
163135
|
-
function getDefinitionAndBoundSpan(fileName, position
|
|
163079
|
+
function getDefinitionAndBoundSpan(fileName, position) {
|
|
163136
163080
|
synchronizeHostData();
|
|
163137
|
-
return ts.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position
|
|
163081
|
+
return ts.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position);
|
|
163138
163082
|
}
|
|
163139
163083
|
function getTypeDefinitionAtPosition(fileName, position) {
|
|
163140
163084
|
synchronizeHostData();
|
|
@@ -166303,9 +166247,6 @@ var ts;
|
|
|
166303
166247
|
CommandTypes["SignatureHelp"] = "signatureHelp";
|
|
166304
166248
|
/* @internal */
|
|
166305
166249
|
CommandTypes["SignatureHelpFull"] = "signatureHelp-full";
|
|
166306
|
-
CommandTypes["SourceDefinitionAndBoundSpan"] = "sourceDefinitionAndBoundSpan";
|
|
166307
|
-
/* @internal */
|
|
166308
|
-
CommandTypes["SourceDefinitionAndBoundSpanFull"] = "sourceDefinitionAndBoundSpan-full";
|
|
166309
166250
|
CommandTypes["Status"] = "status";
|
|
166310
166251
|
CommandTypes["TypeDefinition"] = "typeDefinition";
|
|
166311
166252
|
CommandTypes["ProjectInfo"] = "projectInfo";
|
|
@@ -167175,7 +167116,6 @@ var ts;
|
|
|
167175
167116
|
ProjectKind[ProjectKind["Configured"] = 1] = "Configured";
|
|
167176
167117
|
ProjectKind[ProjectKind["External"] = 2] = "External";
|
|
167177
167118
|
ProjectKind[ProjectKind["AutoImportProvider"] = 3] = "AutoImportProvider";
|
|
167178
|
-
ProjectKind[ProjectKind["Auxiliary"] = 4] = "Auxiliary";
|
|
167179
167119
|
})(ProjectKind = server.ProjectKind || (server.ProjectKind = {}));
|
|
167180
167120
|
/* @internal */
|
|
167181
167121
|
function countEachFileTypes(infos, includeSizes) {
|
|
@@ -168621,17 +168561,6 @@ var ts;
|
|
|
168621
168561
|
Project.prototype.getIncompleteCompletionsCache = function () {
|
|
168622
168562
|
return this.projectService.getIncompleteCompletionsCache();
|
|
168623
168563
|
};
|
|
168624
|
-
Project.prototype.withAuxiliaryProjectForFiles = function (fileNames, cb) {
|
|
168625
|
-
var options = __assign(__assign({}, this.getCompilerOptions()), { noDtsResolution: true, allowJs: true, maxNodeModuleJsDepth: 3, diagnostics: false, skipLibCheck: true, sourceMap: false, types: ts.emptyArray, lib: ts.emptyArray, noLib: true });
|
|
168626
|
-
var project = new AuxiliaryProject(this.projectService, this.documentRegistry, options);
|
|
168627
|
-
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
|
168628
|
-
var fileName = fileNames_1[_i];
|
|
168629
|
-
project.addRoot(this.getScriptInfo(fileName));
|
|
168630
|
-
}
|
|
168631
|
-
project.updateGraph();
|
|
168632
|
-
cb(project);
|
|
168633
|
-
project.close();
|
|
168634
|
-
};
|
|
168635
168564
|
return Project;
|
|
168636
168565
|
}());
|
|
168637
168566
|
server.Project = Project;
|
|
@@ -168743,22 +168672,6 @@ var ts;
|
|
|
168743
168672
|
return InferredProject;
|
|
168744
168673
|
}(Project));
|
|
168745
168674
|
server.InferredProject = InferredProject;
|
|
168746
|
-
var AuxiliaryProject = /** @class */ (function (_super) {
|
|
168747
|
-
__extends(AuxiliaryProject, _super);
|
|
168748
|
-
function AuxiliaryProject(projectService, documentRegistry, parentCompilerOptions) {
|
|
168749
|
-
var _this = this;
|
|
168750
|
-
var options = __assign(__assign({}, parentCompilerOptions), { resolveJsOnly: true, allowJs: true, maxNodeModuleJsDepth: 3, diagnostics: false, skipLibCheck: true, sourceMap: false, types: ts.emptyArray, lib: ts.emptyArray, noLib: true });
|
|
168751
|
-
_this = _super.call(this, "js-analysis", ProjectKind.Auxiliary, projectService, documentRegistry,
|
|
168752
|
-
/*hasExplicitListOfFiles*/ false,
|
|
168753
|
-
/*lastFileExceededProgramSize*/ undefined, options,
|
|
168754
|
-
/*compileOnSaveEnabled*/ false,
|
|
168755
|
-
/*watchOptions*/ undefined, projectService.host,
|
|
168756
|
-
/*currentDirectory*/ undefined) || this;
|
|
168757
|
-
return _this;
|
|
168758
|
-
}
|
|
168759
|
-
return AuxiliaryProject;
|
|
168760
|
-
}(Project));
|
|
168761
|
-
server.AuxiliaryProject = AuxiliaryProject;
|
|
168762
168675
|
var AutoImportProviderProject = /** @class */ (function (_super) {
|
|
168763
168676
|
__extends(AutoImportProviderProject, _super);
|
|
168764
168677
|
/*@internal*/
|
|
@@ -170647,8 +170560,8 @@ var ts;
|
|
|
170647
170560
|
this.projectToSizeMap.set(name, 0);
|
|
170648
170561
|
this.projectToSizeMap.forEach(function (val) { return (availableSpace -= (val || 0)); });
|
|
170649
170562
|
var totalNonTsFileSize = 0;
|
|
170650
|
-
for (var _i = 0,
|
|
170651
|
-
var f =
|
|
170563
|
+
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
|
170564
|
+
var f = fileNames_1[_i];
|
|
170652
170565
|
var fileName = propertyReader.getFileName(f);
|
|
170653
170566
|
if (ts.hasTSFileExtension(fileName)) {
|
|
170654
170567
|
continue;
|
|
@@ -173361,12 +173274,6 @@ var ts;
|
|
|
173361
173274
|
_a[server.CommandNames.DefinitionAndBoundSpanFull] = function (request) {
|
|
173362
173275
|
return _this.requiredResponse(_this.getDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
173363
173276
|
},
|
|
173364
|
-
// [CommandNames.SourceDefinitionAndBoundSpan]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => {
|
|
173365
|
-
// return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ true));
|
|
173366
|
-
// },
|
|
173367
|
-
// [CommandNames.SourceDefinitionAndBoundSpanFull]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => {
|
|
173368
|
-
// return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
|
|
173369
|
-
// },
|
|
173370
173277
|
_a[server.CommandNames.EmitOutput] = function (request) {
|
|
173371
173278
|
return _this.requiredResponse(_this.getEmitOutput(request.arguments));
|
|
173372
173279
|
},
|
|
@@ -174103,34 +174010,10 @@ var ts;
|
|
|
174103
174010
|
Session.prototype.mapDefinitionInfoLocations = function (definitions, project) {
|
|
174104
174011
|
return definitions.map(function (info) {
|
|
174105
174012
|
var newDocumentSpan = getMappedDocumentSpan(info, project);
|
|
174106
|
-
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name
|
|
174013
|
+
return !newDocumentSpan ? info : __assign(__assign(__assign({}, newDocumentSpan), { containerKind: info.containerKind, containerName: info.containerName, kind: info.kind, name: info.name }), info.unverified && { unverified: info.unverified });
|
|
174107
174014
|
});
|
|
174108
174015
|
};
|
|
174109
174016
|
Session.prototype.getDefinitionAndBoundSpan = function (args, simplifiedResult) {
|
|
174110
|
-
// const { file, project } = this.getFileAndProject(args);
|
|
174111
|
-
// const position = this.getPositionInFile(args, file);
|
|
174112
|
-
// const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
|
|
174113
|
-
// const unmappedDefinitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file, position);
|
|
174114
|
-
// if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) {
|
|
174115
|
-
// return {
|
|
174116
|
-
// definitions: emptyArray,
|
|
174117
|
-
// textSpan: undefined! // TODO: GH#18217
|
|
174118
|
-
// };
|
|
174119
|
-
// }
|
|
174120
|
-
// const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project);
|
|
174121
|
-
// const { textSpan } = unmappedDefinitionAndBoundSpan;
|
|
174122
|
-
// if (simplifiedResult) {
|
|
174123
|
-
// return {
|
|
174124
|
-
// definitions: this.mapDefinitionInfo(definitions, project),
|
|
174125
|
-
// textSpan: toProtocolTextSpan(textSpan, scriptInfo)
|
|
174126
|
-
// };
|
|
174127
|
-
// }
|
|
174128
|
-
// return {
|
|
174129
|
-
// definitions: definitions.map(Session.mapToOriginalLocation),
|
|
174130
|
-
// textSpan,
|
|
174131
|
-
// };
|
|
174132
|
-
// }
|
|
174133
|
-
// private getSourceDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan {
|
|
174134
174017
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
174135
174018
|
var position = this.getPositionInFile(args, file);
|
|
174136
174019
|
var scriptInfo = ts.Debug.checkDefined(project.getScriptInfo(file));
|
|
@@ -174141,31 +174024,7 @@ var ts;
|
|
|
174141
174024
|
textSpan: undefined // TODO: GH#18217
|
|
174142
174025
|
};
|
|
174143
174026
|
}
|
|
174144
|
-
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project)
|
|
174145
|
-
var needsJsResolution = !ts.some(definitions, function (d) { return !!d.isAliasTarget && !d.isAmbient; }) || ts.some(definitions, function (d) { return !!d.failedAliasResolution; });
|
|
174146
|
-
if (needsJsResolution) {
|
|
174147
|
-
project.withAuxiliaryProjectForFiles([file], function (auxiliaryProject) {
|
|
174148
|
-
var ls = auxiliaryProject.getLanguageService();
|
|
174149
|
-
var jsDefinitions = ls.getDefinitionAndBoundSpan(file, position, /*aliasesOnly*/ true);
|
|
174150
|
-
if (ts.some(jsDefinitions === null || jsDefinitions === void 0 ? void 0 : jsDefinitions.definitions)) {
|
|
174151
|
-
for (var _i = 0, _a = jsDefinitions.definitions; _i < _a.length; _i++) {
|
|
174152
|
-
var jsDefinition = _a[_i];
|
|
174153
|
-
if (jsDefinition.unverified) {
|
|
174154
|
-
var refined = tryRefineDefinition(jsDefinition, project.getLanguageService().getProgram(), ls.getProgram());
|
|
174155
|
-
if (ts.some(refined)) {
|
|
174156
|
-
for (var _b = 0, _c = refined || server.emptyArray; _b < _c.length; _b++) {
|
|
174157
|
-
var def = _c[_b];
|
|
174158
|
-
ts.pushIfUnique(definitions, def, ts.documentSpansEqual);
|
|
174159
|
-
}
|
|
174160
|
-
continue;
|
|
174161
|
-
}
|
|
174162
|
-
}
|
|
174163
|
-
ts.pushIfUnique(definitions, jsDefinition, ts.documentSpansEqual);
|
|
174164
|
-
}
|
|
174165
|
-
}
|
|
174166
|
-
});
|
|
174167
|
-
}
|
|
174168
|
-
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
174027
|
+
var definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project);
|
|
174169
174028
|
var textSpan = unmappedDefinitionAndBoundSpan.textSpan;
|
|
174170
174029
|
if (simplifiedResult) {
|
|
174171
174030
|
return {
|
|
@@ -174177,32 +174036,6 @@ var ts;
|
|
|
174177
174036
|
definitions: definitions.map(Session.mapToOriginalLocation),
|
|
174178
174037
|
textSpan: textSpan,
|
|
174179
174038
|
};
|
|
174180
|
-
function tryRefineDefinition(definition, program, auxiliaryProgram) {
|
|
174181
|
-
var _a, _b;
|
|
174182
|
-
var fileToSearch = auxiliaryProgram.getSourceFile(definition.fileName);
|
|
174183
|
-
if (!fileToSearch) {
|
|
174184
|
-
return undefined;
|
|
174185
|
-
}
|
|
174186
|
-
var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position);
|
|
174187
|
-
var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode);
|
|
174188
|
-
if (!symbol || !symbol.declarations || ts.some(symbol.declarations, ts.isFreelyNameableImport)) {
|
|
174189
|
-
return undefined;
|
|
174190
|
-
}
|
|
174191
|
-
var nameToSearch = ((_b = (_a = ts.find(symbol.declarations, ts.isImportSpecifier)) === null || _a === void 0 ? void 0 : _a.propertyName) === null || _b === void 0 ? void 0 : _b.text) || symbol.name;
|
|
174192
|
-
return searchForDeclaration(nameToSearch, fileToSearch, auxiliaryProgram);
|
|
174193
|
-
}
|
|
174194
|
-
function searchForDeclaration(declarationName, fileToSearch, auxiliaryProgram) {
|
|
174195
|
-
var matches = ts.FindAllReferences.Core.getTopMostDeclarationNamesInFile(declarationName, fileToSearch);
|
|
174196
|
-
return ts.mapDefined(matches, function (match) {
|
|
174197
|
-
var symbol = auxiliaryProgram.getTypeChecker().getSymbolAtLocation(match);
|
|
174198
|
-
var decl = ts.getDeclarationFromName(match);
|
|
174199
|
-
if (symbol && decl) {
|
|
174200
|
-
// I think the last argument to this is supposed to be the start node, but it doesn't seem important.
|
|
174201
|
-
// Callers internal to GoToDefinition already get confused about this.
|
|
174202
|
-
return ts.GoToDefinition.createDefinitionInfo(decl, auxiliaryProgram.getTypeChecker(), symbol, decl);
|
|
174203
|
-
}
|
|
174204
|
-
});
|
|
174205
|
-
}
|
|
174206
174039
|
};
|
|
174207
174040
|
Session.prototype.getEmitOutput = function (args) {
|
|
174208
174041
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|