@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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220316";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8228,7 +8228,7 @@ var ts;
|
|
|
8228
8228
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
8229
8229
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
8230
8230
|
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."),
|
|
8231
|
-
|
|
8231
|
+
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."),
|
|
8232
8232
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
8233
8233
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
8234
8234
|
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."),
|
|
@@ -15144,10 +15144,6 @@ var ts;
|
|
|
15144
15144
|
}
|
|
15145
15145
|
}
|
|
15146
15146
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
15147
|
-
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
15148
|
-
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
15149
|
-
}
|
|
15150
|
-
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
15151
15147
|
function isLateVisibilityPaintedStatement(node) {
|
|
15152
15148
|
switch (node.kind) {
|
|
15153
15149
|
case 265 /* ImportDeclaration */:
|
|
@@ -16726,14 +16722,14 @@ var ts;
|
|
|
16726
16722
|
}
|
|
16727
16723
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16728
16724
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16729
|
-
var _a, _b;
|
|
16725
|
+
var _a, _b, _c;
|
|
16730
16726
|
switch (node.kind) {
|
|
16731
16727
|
case 253 /* VariableDeclaration */:
|
|
16732
|
-
return
|
|
16728
|
+
return node.initializer.arguments[0].text;
|
|
16733
16729
|
case 265 /* ImportDeclaration */:
|
|
16734
|
-
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16730
|
+
return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
|
|
16735
16731
|
case 264 /* ImportEqualsDeclaration */:
|
|
16736
|
-
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16732
|
+
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;
|
|
16737
16733
|
default:
|
|
16738
16734
|
ts.Debug.assertNever(node);
|
|
16739
16735
|
}
|
|
@@ -17260,28 +17256,21 @@ var ts;
|
|
|
17260
17256
|
// export = <EntityNameExpression>
|
|
17261
17257
|
// export default <EntityNameExpression>
|
|
17262
17258
|
// module.exports = <EntityNameExpression>
|
|
17263
|
-
//
|
|
17264
|
-
//
|
|
17265
|
-
// const { x } = require("...")
|
|
17266
|
-
// const x = require("...").y
|
|
17267
|
-
// const { x } = require("...").y
|
|
17259
|
+
// {<Identifier>}
|
|
17260
|
+
// {name: <EntityNameExpression>}
|
|
17268
17261
|
function isAliasSymbolDeclaration(node) {
|
|
17269
|
-
|
|
17262
|
+
return node.kind === 264 /* ImportEqualsDeclaration */ ||
|
|
17270
17263
|
node.kind === 263 /* NamespaceExportDeclaration */ ||
|
|
17271
17264
|
node.kind === 266 /* ImportClause */ && !!node.name ||
|
|
17272
17265
|
node.kind === 267 /* NamespaceImport */ ||
|
|
17273
17266
|
node.kind === 273 /* NamespaceExport */ ||
|
|
17274
17267
|
node.kind === 269 /* ImportSpecifier */ ||
|
|
17275
17268
|
node.kind === 274 /* ExportSpecifier */ ||
|
|
17276
|
-
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17277
|
-
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
&& ts.isBinaryExpression(node.parent)
|
|
17282
|
-
&& node.parent.left === node
|
|
17283
|
-
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17284
|
-
&& isAliasableExpression(node.parent.right));
|
|
17269
|
+
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
|
|
17270
|
+
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17271
|
+
ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
|
|
17272
|
+
node.kind === 296 /* ShorthandPropertyAssignment */ ||
|
|
17273
|
+
node.kind === 295 /* PropertyAssignment */ && isAliasableExpression(node.initializer);
|
|
17285
17274
|
}
|
|
17286
17275
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17287
17276
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17292,7 +17281,6 @@ var ts;
|
|
|
17292
17281
|
case 274 /* ExportSpecifier */:
|
|
17293
17282
|
case 270 /* ExportAssignment */:
|
|
17294
17283
|
case 264 /* ImportEqualsDeclaration */:
|
|
17295
|
-
case 273 /* NamespaceExport */:
|
|
17296
17284
|
return node.parent;
|
|
17297
17285
|
case 160 /* QualifiedName */:
|
|
17298
17286
|
do {
|
|
@@ -31632,20 +31620,23 @@ var ts;
|
|
|
31632
31620
|
return inContext(32768 /* AwaitContext */);
|
|
31633
31621
|
}
|
|
31634
31622
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
31635
|
-
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31623
|
+
return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31636
31624
|
}
|
|
31637
31625
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
31638
31626
|
// Don't report another error if it would just be at the same position as the last error.
|
|
31639
31627
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
31628
|
+
var result;
|
|
31640
31629
|
if (!lastError || start !== lastError.start) {
|
|
31641
|
-
|
|
31630
|
+
result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
|
|
31631
|
+
parseDiagnostics.push(result);
|
|
31642
31632
|
}
|
|
31643
31633
|
// Mark that we've encountered an error. We'll set an appropriate bit on the next
|
|
31644
31634
|
// node we finish so that it can't be reused incrementally.
|
|
31645
31635
|
parseErrorBeforeNextFinishedNode = true;
|
|
31636
|
+
return result;
|
|
31646
31637
|
}
|
|
31647
31638
|
function parseErrorAt(start, end, message, arg0) {
|
|
31648
|
-
parseErrorAtPosition(start, end - start, message, arg0);
|
|
31639
|
+
return parseErrorAtPosition(start, end - start, message, arg0);
|
|
31649
31640
|
}
|
|
31650
31641
|
function parseErrorAtRange(range, message, arg0) {
|
|
31651
31642
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -31918,6 +31909,19 @@ var ts;
|
|
|
31918
31909
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
31919
31910
|
return false;
|
|
31920
31911
|
}
|
|
31912
|
+
function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
|
|
31913
|
+
if (token() === closeKind) {
|
|
31914
|
+
nextToken();
|
|
31915
|
+
return;
|
|
31916
|
+
}
|
|
31917
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
31918
|
+
if (!openParsed) {
|
|
31919
|
+
return;
|
|
31920
|
+
}
|
|
31921
|
+
if (lastError) {
|
|
31922
|
+
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)));
|
|
31923
|
+
}
|
|
31924
|
+
}
|
|
31921
31925
|
function parseOptional(t) {
|
|
31922
31926
|
if (token() === t) {
|
|
31923
31927
|
nextToken();
|
|
@@ -33566,7 +33570,7 @@ var ts;
|
|
|
33566
33570
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
33567
33571
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
33568
33572
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
33569
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
33573
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
33570
33574
|
}
|
|
33571
33575
|
}
|
|
33572
33576
|
return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
@@ -35376,10 +35380,11 @@ var ts;
|
|
|
35376
35380
|
}
|
|
35377
35381
|
function parseArrayLiteralExpression() {
|
|
35378
35382
|
var pos = getNodePos();
|
|
35379
|
-
|
|
35383
|
+
var openBracketPosition = scanner.getTokenPos();
|
|
35384
|
+
var openBracketParsed = parseExpected(22 /* OpenBracketToken */);
|
|
35380
35385
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35381
35386
|
var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
35382
|
-
|
|
35387
|
+
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
|
|
35383
35388
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
35384
35389
|
}
|
|
35385
35390
|
function parseObjectLiteralElement() {
|
|
@@ -35436,15 +35441,10 @@ var ts;
|
|
|
35436
35441
|
function parseObjectLiteralExpression() {
|
|
35437
35442
|
var pos = getNodePos();
|
|
35438
35443
|
var openBracePosition = scanner.getTokenPos();
|
|
35439
|
-
parseExpected(18 /* OpenBraceToken */);
|
|
35444
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */);
|
|
35440
35445
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35441
35446
|
var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
|
|
35442
|
-
|
|
35443
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35444
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35445
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35446
|
-
}
|
|
35447
|
-
}
|
|
35447
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35448
35448
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
35449
35449
|
}
|
|
35450
35450
|
function parseFunctionExpression() {
|
|
@@ -35500,15 +35500,11 @@ var ts;
|
|
|
35500
35500
|
var pos = getNodePos();
|
|
35501
35501
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35502
35502
|
var openBracePosition = scanner.getTokenPos();
|
|
35503
|
-
|
|
35503
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
|
|
35504
|
+
if (openBraceParsed || ignoreMissingOpenBrace) {
|
|
35504
35505
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35505
35506
|
var statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
35506
|
-
|
|
35507
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35508
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35509
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35510
|
-
}
|
|
35511
|
-
}
|
|
35507
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35512
35508
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
35513
35509
|
if (token() === 63 /* EqualsToken */) {
|
|
35514
35510
|
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);
|
|
@@ -35553,9 +35549,10 @@ var ts;
|
|
|
35553
35549
|
var pos = getNodePos();
|
|
35554
35550
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35555
35551
|
parseExpected(99 /* IfKeyword */);
|
|
35556
|
-
|
|
35552
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35553
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35557
35554
|
var expression = allowInAnd(parseExpression);
|
|
35558
|
-
|
|
35555
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35559
35556
|
var thenStatement = parseStatement();
|
|
35560
35557
|
var elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : undefined;
|
|
35561
35558
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -35566,9 +35563,10 @@ var ts;
|
|
|
35566
35563
|
parseExpected(90 /* DoKeyword */);
|
|
35567
35564
|
var statement = parseStatement();
|
|
35568
35565
|
parseExpected(115 /* WhileKeyword */);
|
|
35569
|
-
|
|
35566
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35567
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35570
35568
|
var expression = allowInAnd(parseExpression);
|
|
35571
|
-
|
|
35569
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35572
35570
|
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
|
|
35573
35571
|
// 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
|
|
35574
35572
|
// spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
|
|
@@ -35580,9 +35578,10 @@ var ts;
|
|
|
35580
35578
|
var pos = getNodePos();
|
|
35581
35579
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35582
35580
|
parseExpected(115 /* WhileKeyword */);
|
|
35583
|
-
|
|
35581
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35582
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35584
35583
|
var expression = allowInAnd(parseExpression);
|
|
35585
|
-
|
|
35584
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35586
35585
|
var statement = parseStatement();
|
|
35587
35586
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
35588
35587
|
}
|
|
@@ -35649,9 +35648,10 @@ var ts;
|
|
|
35649
35648
|
var pos = getNodePos();
|
|
35650
35649
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35651
35650
|
parseExpected(116 /* WithKeyword */);
|
|
35652
|
-
|
|
35651
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35652
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35653
35653
|
var expression = allowInAnd(parseExpression);
|
|
35654
|
-
|
|
35654
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35655
35655
|
var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
|
|
35656
35656
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
35657
35657
|
}
|
|
@@ -36785,7 +36785,7 @@ var ts;
|
|
|
36785
36785
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
36786
36786
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
36787
36787
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
36788
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
36788
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
36789
36789
|
}
|
|
36790
36790
|
}
|
|
36791
36791
|
return finishNode(factory.createAssertClause(elements, multiLine), pos);
|
|
@@ -37761,8 +37761,7 @@ var ts;
|
|
|
37761
37761
|
hasChildren = true;
|
|
37762
37762
|
if (child.kind === 342 /* JSDocTypeTag */) {
|
|
37763
37763
|
if (childTypeTag) {
|
|
37764
|
-
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37765
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
37764
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37766
37765
|
if (lastError) {
|
|
37767
37766
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
37768
37767
|
}
|
|
@@ -39640,13 +39639,6 @@ var ts;
|
|
|
39640
39639
|
description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
|
39641
39640
|
defaultValueDescription: false,
|
|
39642
39641
|
},
|
|
39643
|
-
{
|
|
39644
|
-
name: "noDtsResolution",
|
|
39645
|
-
type: "boolean",
|
|
39646
|
-
affectsModuleResolution: true,
|
|
39647
|
-
category: ts.Diagnostics.Modules,
|
|
39648
|
-
defaultValueDescription: false,
|
|
39649
|
-
},
|
|
39650
39642
|
// Source Maps
|
|
39651
39643
|
{
|
|
39652
39644
|
name: "sourceRoot",
|
|
@@ -42026,8 +42018,7 @@ var ts;
|
|
|
42026
42018
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42027
42019
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42028
42020
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42029
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42030
|
-
Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
|
|
42021
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
|
|
42031
42022
|
})(Extensions || (Extensions = {}));
|
|
42032
42023
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42033
42024
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -42972,21 +42963,7 @@ var ts;
|
|
|
42972
42963
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
42973
42964
|
}
|
|
42974
42965
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
42975
|
-
|
|
42976
|
-
if (lookupConfig) {
|
|
42977
|
-
extensions = tsconfigExtensions;
|
|
42978
|
-
}
|
|
42979
|
-
else if (compilerOptions.noDtsResolution) {
|
|
42980
|
-
extensions = [Extensions.TypeScriptButNotDts];
|
|
42981
|
-
if (compilerOptions.allowJs)
|
|
42982
|
-
extensions.push(Extensions.JavaScript);
|
|
42983
|
-
if (compilerOptions.resolveJsonModule)
|
|
42984
|
-
extensions.push(Extensions.Json);
|
|
42985
|
-
}
|
|
42986
|
-
else {
|
|
42987
|
-
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
42988
|
-
}
|
|
42989
|
-
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
42966
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
42990
42967
|
}
|
|
42991
42968
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
42992
42969
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -42995,10 +42972,6 @@ var ts;
|
|
|
42995
42972
|
var failedLookupLocations = [];
|
|
42996
42973
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
42997
42974
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
42998
|
-
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
42999
|
-
if (compilerOptions.noDtsResolution) {
|
|
43000
|
-
conditions.pop();
|
|
43001
|
-
}
|
|
43002
42975
|
var state = {
|
|
43003
42976
|
compilerOptions: compilerOptions,
|
|
43004
42977
|
host: host,
|
|
@@ -43006,7 +42979,7 @@ var ts;
|
|
|
43006
42979
|
failedLookupLocations: failedLookupLocations,
|
|
43007
42980
|
packageJsonInfoCache: cache,
|
|
43008
42981
|
features: features,
|
|
43009
|
-
conditions:
|
|
42982
|
+
conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
|
|
43010
42983
|
};
|
|
43011
42984
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43012
42985
|
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);
|
|
@@ -43214,22 +43187,20 @@ var ts;
|
|
|
43214
43187
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43215
43188
|
}
|
|
43216
43189
|
case Extensions.TypeScript:
|
|
43217
|
-
case Extensions.TypeScriptButNotDts:
|
|
43218
|
-
var useDts = extensions === Extensions.TypeScript;
|
|
43219
43190
|
switch (originalExtension) {
|
|
43220
43191
|
case ".mjs" /* Mjs */:
|
|
43221
43192
|
case ".mts" /* Mts */:
|
|
43222
43193
|
case ".d.mts" /* Dmts */:
|
|
43223
|
-
return tryExtension(".mts" /* Mts */) ||
|
|
43194
|
+
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43224
43195
|
case ".cjs" /* Cjs */:
|
|
43225
43196
|
case ".cts" /* Cts */:
|
|
43226
43197
|
case ".d.cts" /* Dcts */:
|
|
43227
|
-
return tryExtension(".cts" /* Cts */) ||
|
|
43198
|
+
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43228
43199
|
case ".json" /* Json */:
|
|
43229
43200
|
candidate += ".json" /* Json */;
|
|
43230
|
-
return
|
|
43201
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
43231
43202
|
default:
|
|
43232
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) ||
|
|
43203
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43233
43204
|
}
|
|
43234
43205
|
case Extensions.JavaScript:
|
|
43235
43206
|
switch (originalExtension) {
|
|
@@ -43447,7 +43418,6 @@ var ts;
|
|
|
43447
43418
|
switch (extensions) {
|
|
43448
43419
|
case Extensions.JavaScript:
|
|
43449
43420
|
case Extensions.Json:
|
|
43450
|
-
case Extensions.TypeScriptButNotDts:
|
|
43451
43421
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43452
43422
|
break;
|
|
43453
43423
|
case Extensions.TypeScript:
|
|
@@ -43526,8 +43496,6 @@ var ts;
|
|
|
43526
43496
|
return extension === ".json" /* Json */;
|
|
43527
43497
|
case Extensions.TypeScript:
|
|
43528
43498
|
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43529
|
-
case Extensions.TypeScriptButNotDts:
|
|
43530
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */;
|
|
43531
43499
|
case Extensions.DtsOnly:
|
|
43532
43500
|
return extension === ".d.ts" /* Dts */;
|
|
43533
43501
|
}
|
|
@@ -55144,7 +55112,7 @@ var ts;
|
|
|
55144
55112
|
if (!omitTypeAlias) {
|
|
55145
55113
|
return errorType;
|
|
55146
55114
|
}
|
|
55147
|
-
return
|
|
55115
|
+
return getGlobalTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
55148
55116
|
}
|
|
55149
55117
|
var members = ts.createSymbolTable();
|
|
55150
55118
|
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
@@ -55596,7 +55564,7 @@ var ts;
|
|
|
55596
55564
|
}
|
|
55597
55565
|
}
|
|
55598
55566
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55599
|
-
type = getUnionType(sourceTypes);
|
|
55567
|
+
type = getUnionType(sourceTypes, 2 /* Subtype */);
|
|
55600
55568
|
}
|
|
55601
55569
|
}
|
|
55602
55570
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -56911,7 +56879,7 @@ var ts;
|
|
|
56911
56879
|
}
|
|
56912
56880
|
}
|
|
56913
56881
|
if (memberTypeList.length) {
|
|
56914
|
-
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined);
|
|
56882
|
+
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined);
|
|
56915
56883
|
if (enumType_1.flags & 1048576 /* Union */) {
|
|
56916
56884
|
enumType_1.flags |= 1024 /* EnumLiteral */;
|
|
56917
56885
|
enumType_1.symbol = symbol;
|
|
@@ -58531,8 +58499,10 @@ var ts;
|
|
|
58531
58499
|
return type;
|
|
58532
58500
|
}
|
|
58533
58501
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
58534
|
-
|
|
58535
|
-
|
|
58502
|
+
var objectType;
|
|
58503
|
+
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58504
|
+
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58505
|
+
!objectType.declaration.questionToken && !objectType.declaration.nameType);
|
|
58536
58506
|
}
|
|
58537
58507
|
/**
|
|
58538
58508
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -59120,7 +59090,19 @@ var ts;
|
|
|
59120
59090
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
59121
59091
|
});
|
|
59122
59092
|
var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
59123
|
-
|
|
59093
|
+
if (lastParamVariadicType) {
|
|
59094
|
+
// Parameter has effective annotation, lock in type
|
|
59095
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
59096
|
+
}
|
|
59097
|
+
else {
|
|
59098
|
+
// Parameter has no annotation
|
|
59099
|
+
// 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
|
|
59100
|
+
// cached by `getTypeOfSymbol` yet.
|
|
59101
|
+
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
59102
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
59103
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
59104
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
59105
|
+
}
|
|
59124
59106
|
if (lastParamVariadicType) {
|
|
59125
59107
|
// Replace the last parameter with a rest parameter.
|
|
59126
59108
|
parameters.pop();
|
|
@@ -59620,7 +59602,7 @@ var ts;
|
|
|
59620
59602
|
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
|
59621
59603
|
return type;
|
|
59622
59604
|
}
|
|
59623
|
-
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) {
|
|
59605
|
+
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
59624
59606
|
if (!aliasSymbol) {
|
|
59625
59607
|
aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59626
59608
|
var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
|
@@ -59632,6 +59614,7 @@ var ts;
|
|
|
59632
59614
|
type.mapper = mapper;
|
|
59633
59615
|
type.aliasSymbol = aliasSymbol;
|
|
59634
59616
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
59617
|
+
type.aliasMapper = aliasMapper;
|
|
59635
59618
|
return type;
|
|
59636
59619
|
}
|
|
59637
59620
|
function getTypeArguments(type) {
|
|
@@ -59696,7 +59679,7 @@ var ts;
|
|
|
59696
59679
|
}
|
|
59697
59680
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59698
59681
|
}
|
|
59699
|
-
function
|
|
59682
|
+
function getGlobalTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
59700
59683
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59701
59684
|
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59702
59685
|
return getStringMappingType(symbol, typeArguments[0]);
|
|
@@ -59710,6 +59693,33 @@ var ts;
|
|
|
59710
59693
|
}
|
|
59711
59694
|
return instantiation;
|
|
59712
59695
|
}
|
|
59696
|
+
function getLocalTypeAliasInstantiation(symbol, typeArguments, outerTypeParameterMapper, aliasSymbol, aliasTypeArguments) {
|
|
59697
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59698
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59699
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
59700
|
+
}
|
|
59701
|
+
var links = getSymbolLinks(symbol);
|
|
59702
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(symbol);
|
|
59703
|
+
var mappedOuterParams = outerTypeParameterMapper && outerTypeParameters && instantiateTypes(outerTypeParameters, outerTypeParameterMapper);
|
|
59704
|
+
var typeParameters = links.typeParameters;
|
|
59705
|
+
var id = getTypeListId(ts.concatenate(mappedOuterParams, typeArguments)) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59706
|
+
var instantiation = links.instantiations.get(id);
|
|
59707
|
+
if (!instantiation) {
|
|
59708
|
+
var outerTypeArgumentMapper = outerTypeParameters && mappedOuterParams && createTypeMapper(outerTypeParameters, mappedOuterParams);
|
|
59709
|
+
var argumentMapper = createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(symbol.valueDeclaration)));
|
|
59710
|
+
var combinedMapper = outerTypeArgumentMapper ? combineTypeMappers(argumentMapper, outerTypeArgumentMapper) : argumentMapper;
|
|
59711
|
+
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, combinedMapper, aliasSymbol, aliasTypeArguments));
|
|
59712
|
+
}
|
|
59713
|
+
return instantiation;
|
|
59714
|
+
}
|
|
59715
|
+
function getOuterTypeParametersOfAlias(symbol) {
|
|
59716
|
+
var _a;
|
|
59717
|
+
var links = getSymbolLinks(symbol);
|
|
59718
|
+
if (!links.outerTypeParameters) {
|
|
59719
|
+
links.outerTypeParameters = ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && getOuterTypeParameters(symbol.declarations[0], /*includeThisTypes*/ true);
|
|
59720
|
+
}
|
|
59721
|
+
return links.outerTypeParameters;
|
|
59722
|
+
}
|
|
59713
59723
|
/**
|
|
59714
59724
|
* Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
|
|
59715
59725
|
* references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
|
|
@@ -59745,7 +59755,7 @@ var ts;
|
|
|
59745
59755
|
// a .d.ts file. See #43622 for an example.
|
|
59746
59756
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59747
59757
|
var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : undefined;
|
|
59748
|
-
return
|
|
59758
|
+
return getGlobalTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
|
|
59749
59759
|
}
|
|
59750
59760
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59751
59761
|
}
|
|
@@ -60660,14 +60670,7 @@ var ts;
|
|
|
60660
60670
|
result.types = types;
|
|
60661
60671
|
return result;
|
|
60662
60672
|
}
|
|
60663
|
-
|
|
60664
|
-
// flag is specified we also reduce the constituent type set to only include types that aren't subtypes
|
|
60665
|
-
// of other types. Subtype reduction is expensive for large union types and is possible only when union
|
|
60666
|
-
// types are known not to circularly reference themselves (as is the case with union types created by
|
|
60667
|
-
// expression constructs such as array literals and the || and ?: operators). Named types can
|
|
60668
|
-
// circularly reference themselves and therefore cannot be subtype reduced during their declaration.
|
|
60669
|
-
// For example, "type Item = string | (() => Item" is a named type that circularly references itself.
|
|
60670
|
-
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) {
|
|
60673
|
+
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60671
60674
|
if (unionReduction === void 0) { unionReduction = 1 /* Literal */; }
|
|
60672
60675
|
if (types.length === 0) {
|
|
60673
60676
|
return neverType;
|
|
@@ -60736,7 +60739,7 @@ var ts;
|
|
|
60736
60739
|
}
|
|
60737
60740
|
var objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
|
|
60738
60741
|
(includes & 2097152 /* Intersection */ ? 33554432 /* ContainsIntersections */ : 0);
|
|
60739
|
-
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60742
|
+
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
60740
60743
|
}
|
|
60741
60744
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
60742
60745
|
var first;
|
|
@@ -60774,7 +60777,7 @@ var ts;
|
|
|
60774
60777
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
60775
60778
|
}
|
|
60776
60779
|
// This function assumes the constituent type list is sorted and deduplicated.
|
|
60777
|
-
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
60780
|
+
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60778
60781
|
if (types.length === 0) {
|
|
60779
60782
|
return neverType;
|
|
60780
60783
|
}
|
|
@@ -60794,6 +60797,7 @@ var ts;
|
|
|
60794
60797
|
type.origin = origin;
|
|
60795
60798
|
type.aliasSymbol = aliasSymbol;
|
|
60796
60799
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
60800
|
+
type.aliasMapper = aliasMapper;
|
|
60797
60801
|
if (types.length === 2 && types[0].flags & 512 /* BooleanLiteral */ && types[1].flags & 512 /* BooleanLiteral */) {
|
|
60798
60802
|
type.flags |= 16 /* Boolean */;
|
|
60799
60803
|
type.intrinsicName = "boolean";
|
|
@@ -60806,7 +60810,7 @@ var ts;
|
|
|
60806
60810
|
var links = getNodeLinks(node);
|
|
60807
60811
|
if (!links.resolvedType) {
|
|
60808
60812
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60809
|
-
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
60813
|
+
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
60810
60814
|
}
|
|
60811
60815
|
return links.resolvedType;
|
|
60812
60816
|
}
|
|
@@ -60965,25 +60969,16 @@ var ts;
|
|
|
60965
60969
|
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
|
|
60966
60970
|
return true;
|
|
60967
60971
|
}
|
|
60968
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60972
|
+
function createIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60969
60973
|
var result = createType(2097152 /* Intersection */);
|
|
60970
60974
|
result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
|
|
60971
60975
|
result.types = types;
|
|
60972
60976
|
result.aliasSymbol = aliasSymbol;
|
|
60973
60977
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
60978
|
+
result.aliasMapper = aliasMapper;
|
|
60974
60979
|
return result;
|
|
60975
60980
|
}
|
|
60976
|
-
|
|
60977
|
-
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
|
|
60978
|
-
// types with union type constituents into equivalent union types with intersection type constituents and
|
|
60979
|
-
// effectively ensure that union types are always at the top level in type representations.
|
|
60980
|
-
//
|
|
60981
|
-
// We do not perform structural deduplication on intersection types. Intersection types are created only by the &
|
|
60982
|
-
// type operator and we can't reduce those because we want to support recursive intersection types. For example,
|
|
60983
|
-
// a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
|
|
60984
|
-
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
|
|
60985
|
-
// for intersections of types with signatures can be deterministic.
|
|
60986
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60981
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60987
60982
|
var typeMembershipMap = new ts.Map();
|
|
60988
60983
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
60989
60984
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -61043,16 +61038,16 @@ var ts;
|
|
|
61043
61038
|
// When the intersection creates a reduced set (which might mean that *all* union types have
|
|
61044
61039
|
// disappeared), we restart the operation to get a new set of combined flags. Once we have
|
|
61045
61040
|
// reduced we'll never reduce again, so this occurs at most once.
|
|
61046
|
-
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
61041
|
+
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61047
61042
|
}
|
|
61048
61043
|
else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
61049
61044
|
var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
|
|
61050
61045
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
61051
|
-
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61046
|
+
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61052
61047
|
}
|
|
61053
61048
|
else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
61054
61049
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
61055
|
-
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61050
|
+
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61056
61051
|
}
|
|
61057
61052
|
else {
|
|
61058
61053
|
// We are attempting to construct a type of the form X & (A | B) & (C | D). Transform this into a type of
|
|
@@ -61065,7 +61060,7 @@ var ts;
|
|
|
61065
61060
|
// We attach a denormalized origin type when at least one constituent of the cross-product union is an
|
|
61066
61061
|
// intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
|
|
61067
61062
|
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
|
|
61068
|
-
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
61063
|
+
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
61069
61064
|
}
|
|
61070
61065
|
}
|
|
61071
61066
|
else {
|
|
@@ -61111,7 +61106,7 @@ var ts;
|
|
|
61111
61106
|
var links = getNodeLinks(node);
|
|
61112
61107
|
if (!links.resolvedType) {
|
|
61113
61108
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
61114
|
-
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
61109
|
+
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
61115
61110
|
}
|
|
61116
61111
|
return links.resolvedType;
|
|
61117
61112
|
}
|
|
@@ -61230,7 +61225,7 @@ var ts;
|
|
|
61230
61225
|
var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
|
|
61231
61226
|
info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; });
|
|
61232
61227
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
|
|
61233
|
-
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
|
|
61228
|
+
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, origin);
|
|
61234
61229
|
}
|
|
61235
61230
|
/**
|
|
61236
61231
|
* A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
|
|
@@ -61263,7 +61258,7 @@ var ts;
|
|
|
61263
61258
|
return type;
|
|
61264
61259
|
}
|
|
61265
61260
|
var extractTypeAlias = getGlobalExtractSymbol();
|
|
61266
|
-
return extractTypeAlias ?
|
|
61261
|
+
return extractTypeAlias ? getGlobalTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
|
|
61267
61262
|
}
|
|
61268
61263
|
function getIndexTypeOrString(type) {
|
|
61269
61264
|
var indexType = getExtractStringType(getIndexType(type));
|
|
@@ -61393,13 +61388,14 @@ var ts;
|
|
|
61393
61388
|
result.type = type;
|
|
61394
61389
|
return result;
|
|
61395
61390
|
}
|
|
61396
|
-
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
61391
|
+
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61397
61392
|
var type = createType(8388608 /* IndexedAccess */);
|
|
61398
61393
|
type.objectType = objectType;
|
|
61399
61394
|
type.indexType = indexType;
|
|
61400
61395
|
type.accessFlags = accessFlags;
|
|
61401
61396
|
type.aliasSymbol = aliasSymbol;
|
|
61402
61397
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
61398
|
+
type.aliasMapper = aliasMapper;
|
|
61403
61399
|
return type;
|
|
61404
61400
|
}
|
|
61405
61401
|
/**
|
|
@@ -61717,7 +61713,7 @@ var ts;
|
|
|
61717
61713
|
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
|
61718
61714
|
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
|
61719
61715
|
// construct the type Box<T[X]>.
|
|
61720
|
-
if (isGenericMappedType(objectType)) {
|
|
61716
|
+
if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
|
|
61721
61717
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61722
61718
|
}
|
|
61723
61719
|
return type[cache] = type;
|
|
@@ -61757,9 +61753,9 @@ var ts;
|
|
|
61757
61753
|
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
61758
61754
|
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
|
61759
61755
|
}
|
|
61760
|
-
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61756
|
+
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61761
61757
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61762
|
-
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
61758
|
+
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) || (accessNode ? errorType : unknownType);
|
|
61763
61759
|
}
|
|
61764
61760
|
function indexTypeLessThan(indexType, limit) {
|
|
61765
61761
|
return everyType(indexType, function (t) {
|
|
@@ -61773,7 +61769,7 @@ var ts;
|
|
|
61773
61769
|
return false;
|
|
61774
61770
|
});
|
|
61775
61771
|
}
|
|
61776
|
-
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61772
|
+
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61777
61773
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61778
61774
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
61779
61775
|
return wildcardType;
|
|
@@ -61804,7 +61800,7 @@ var ts;
|
|
|
61804
61800
|
var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
61805
61801
|
var type = indexedAccessTypes.get(id);
|
|
61806
61802
|
if (!type) {
|
|
61807
|
-
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments));
|
|
61803
|
+
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments, aliasMapper));
|
|
61808
61804
|
}
|
|
61809
61805
|
return type;
|
|
61810
61806
|
}
|
|
@@ -61834,8 +61830,8 @@ var ts;
|
|
|
61834
61830
|
return undefined;
|
|
61835
61831
|
}
|
|
61836
61832
|
return accessFlags & 4 /* Writing */
|
|
61837
|
-
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments)
|
|
61838
|
-
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61833
|
+
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments, aliasMapper)
|
|
61834
|
+
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61839
61835
|
}
|
|
61840
61836
|
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
61841
61837
|
}
|
|
@@ -61845,7 +61841,7 @@ var ts;
|
|
|
61845
61841
|
var objectType = getTypeFromTypeNode(node.objectType);
|
|
61846
61842
|
var indexType = getTypeFromTypeNode(node.indexType);
|
|
61847
61843
|
var potentialAlias = getAliasSymbolForTypeNode(node);
|
|
61848
|
-
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
|
|
61844
|
+
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias), /*aliasMapper*/ undefined);
|
|
61849
61845
|
links.resolvedType = resolved.flags & 8388608 /* IndexedAccess */ &&
|
|
61850
61846
|
resolved.objectType === objectType &&
|
|
61851
61847
|
resolved.indexType === indexType ?
|
|
@@ -62012,6 +62008,7 @@ var ts;
|
|
|
62012
62008
|
result.combinedMapper = combinedMapper;
|
|
62013
62009
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
62014
62010
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
62011
|
+
result.aliasMapper = result.aliasSymbol ? mapper : undefined;
|
|
62015
62012
|
return "break";
|
|
62016
62013
|
};
|
|
62017
62014
|
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
@@ -62807,7 +62804,7 @@ var ts;
|
|
|
62807
62804
|
var result = target.instantiations.get(id);
|
|
62808
62805
|
if (!result) {
|
|
62809
62806
|
var newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62810
|
-
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62807
|
+
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
62811
62808
|
target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62812
62809
|
instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
62813
62810
|
target.instantiations.set(id, result);
|
|
@@ -62896,7 +62893,7 @@ var ts;
|
|
|
62896
62893
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
62897
62894
|
}
|
|
62898
62895
|
return t;
|
|
62899
|
-
}, aliasSymbol, aliasTypeArguments);
|
|
62896
|
+
}, aliasSymbol, aliasTypeArguments, mapper);
|
|
62900
62897
|
}
|
|
62901
62898
|
}
|
|
62902
62899
|
// If the constraint type of the instantiation is the wildcard type, return the wildcard type.
|
|
@@ -62965,6 +62962,7 @@ var ts;
|
|
|
62965
62962
|
result.mapper = mapper;
|
|
62966
62963
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62967
62964
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62965
|
+
result.aliasMapper = mapper;
|
|
62968
62966
|
return result;
|
|
62969
62967
|
}
|
|
62970
62968
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -62984,7 +62982,7 @@ var ts;
|
|
|
62984
62982
|
// distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
|
|
62985
62983
|
// result is (A extends U ? X : Y) | (B extends U ? X : Y).
|
|
62986
62984
|
result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
|
|
62987
|
-
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
|
|
62985
|
+
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments, mapper) :
|
|
62988
62986
|
getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
|
|
62989
62987
|
root.instantiations.set(id, result);
|
|
62990
62988
|
}
|
|
@@ -63044,8 +63042,8 @@ var ts;
|
|
|
63044
63042
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
63045
63043
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
63046
63044
|
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ?
|
|
63047
|
-
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
|
|
63048
|
-
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
63045
|
+
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
63046
|
+
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
63049
63047
|
}
|
|
63050
63048
|
if (flags & 4194304 /* Index */) {
|
|
63051
63049
|
return getIndexType(instantiateType(type.type, mapper));
|
|
@@ -63059,7 +63057,7 @@ var ts;
|
|
|
63059
63057
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
63060
63058
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
63061
63059
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
63062
|
-
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
|
|
63060
|
+
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
63063
63061
|
}
|
|
63064
63062
|
if (flags & 16777216 /* Conditional */) {
|
|
63065
63063
|
return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
|
|
@@ -63790,7 +63788,7 @@ var ts;
|
|
|
63790
63788
|
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
|
63791
63789
|
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
|
63792
63790
|
: getReturnTypeOfSignature(target);
|
|
63793
|
-
if (targetReturnType === voidType) {
|
|
63791
|
+
if (targetReturnType === voidType || targetReturnType === anyType) {
|
|
63794
63792
|
return result;
|
|
63795
63793
|
}
|
|
63796
63794
|
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
|
@@ -65053,7 +65051,10 @@ var ts;
|
|
|
65053
65051
|
if (variances === ts.emptyArray) {
|
|
65054
65052
|
return 1 /* Unknown */;
|
|
65055
65053
|
}
|
|
65056
|
-
var
|
|
65054
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(source.aliasSymbol);
|
|
65055
|
+
var sourceArgs = outerTypeParameters && source.aliasMapper ? ts.concatenate(source.aliasTypeArguments, instantiateTypes(outerTypeParameters, source.aliasMapper)) : source.aliasTypeArguments;
|
|
65056
|
+
var targetArgs = outerTypeParameters && target.aliasMapper ? ts.concatenate(target.aliasTypeArguments, instantiateTypes(outerTypeParameters, target.aliasMapper)) : target.aliasTypeArguments;
|
|
65057
|
+
var varianceResult = relateVariances(sourceArgs, targetArgs, variances, intersectionState);
|
|
65057
65058
|
if (varianceResult !== undefined) {
|
|
65058
65059
|
return varianceResult;
|
|
65059
65060
|
}
|
|
@@ -66342,8 +66343,11 @@ var ts;
|
|
|
66342
66343
|
}
|
|
66343
66344
|
function getAliasVariances(symbol) {
|
|
66344
66345
|
var links = getSymbolLinks(symbol);
|
|
66345
|
-
|
|
66346
|
-
|
|
66346
|
+
// outer type parameter aliases are last so they can be easily ignored by, eg, inference
|
|
66347
|
+
var params = ts.concatenate(links.typeParameters, getOuterTypeParametersOfAlias(symbol));
|
|
66348
|
+
return getVariancesWorker(params, links, function (_links, param, marker) {
|
|
66349
|
+
var mapper = makeUnaryTypeMapper(param, marker);
|
|
66350
|
+
var type = getLocalTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, mapper), mapper);
|
|
66347
66351
|
type.aliasTypeArgumentsContainsMarker = true;
|
|
66348
66352
|
return type;
|
|
66349
66353
|
});
|
|
@@ -67000,7 +67004,7 @@ var ts;
|
|
|
67000
67004
|
}
|
|
67001
67005
|
// If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
|
|
67002
67006
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
67003
|
-
|
|
67007
|
+
getGlobalTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
67004
67008
|
reducedType;
|
|
67005
67009
|
}
|
|
67006
67010
|
function getNonNullableType(type) {
|
|
@@ -69226,7 +69230,7 @@ var ts;
|
|
|
69226
69230
|
newOrigin = createOriginUnionOrIntersectionType(1048576 /* Union */, originFiltered);
|
|
69227
69231
|
}
|
|
69228
69232
|
}
|
|
69229
|
-
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, newOrigin);
|
|
69233
|
+
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, newOrigin);
|
|
69230
69234
|
}
|
|
69231
69235
|
return type.flags & 131072 /* Never */ || f(type) ? type : neverType;
|
|
69232
69236
|
}
|
|
@@ -69262,9 +69266,9 @@ var ts;
|
|
|
69262
69266
|
}
|
|
69263
69267
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
|
69264
69268
|
}
|
|
69265
|
-
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
69269
|
+
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
69266
69270
|
return type.flags & 1048576 /* Union */ && aliasSymbol ?
|
|
69267
|
-
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) :
|
|
69271
|
+
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper) :
|
|
69268
69272
|
mapType(type, mapper);
|
|
69269
69273
|
}
|
|
69270
69274
|
function extractTypesOfKind(type, kind) {
|
|
@@ -72079,7 +72083,7 @@ var ts;
|
|
|
72079
72083
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
72080
72084
|
return mapType(type, function (t) {
|
|
72081
72085
|
var _a;
|
|
72082
|
-
if (isGenericMappedType(t)) {
|
|
72086
|
+
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
72083
72087
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
72084
72088
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
72085
72089
|
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
@@ -72449,7 +72453,7 @@ var ts;
|
|
|
72449
72453
|
var params = getSymbolLinks(managedSym).typeParameters;
|
|
72450
72454
|
if (ts.length(params) >= 2) {
|
|
72451
72455
|
var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts.isInJSFile(context));
|
|
72452
|
-
return
|
|
72456
|
+
return getGlobalTypeAliasInstantiation(managedSym, args);
|
|
72453
72457
|
}
|
|
72454
72458
|
}
|
|
72455
72459
|
if (ts.length(declaredManagedType.typeParameters) >= 2) {
|
|
@@ -77007,7 +77011,11 @@ var ts;
|
|
|
77007
77011
|
if (signatureHasRestParameter(signature)) {
|
|
77008
77012
|
// parameter might be a transient symbol generated by use of `arguments` in the function body.
|
|
77009
77013
|
var parameter = ts.last(signature.parameters);
|
|
77010
|
-
if (
|
|
77014
|
+
if (parameter.valueDeclaration
|
|
77015
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
77016
|
+
// a declarationless parameter may still have a `.type` already set by its construction logic
|
|
77017
|
+
// (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
|
|
77018
|
+
: !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
|
|
77011
77019
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
77012
77020
|
assignParameterType(parameter, contextualParameterType);
|
|
77013
77021
|
}
|
|
@@ -77026,8 +77034,8 @@ var ts;
|
|
|
77026
77034
|
var links = getSymbolLinks(parameter);
|
|
77027
77035
|
if (!links.type) {
|
|
77028
77036
|
var declaration = parameter.valueDeclaration;
|
|
77029
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
77030
|
-
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
77037
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
|
|
77038
|
+
if (declaration && declaration.name.kind !== 79 /* Identifier */) {
|
|
77031
77039
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
77032
77040
|
if (links.type === unknownType) {
|
|
77033
77041
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
@@ -80589,7 +80597,7 @@ var ts;
|
|
|
80589
80597
|
if (awaitedSymbol) {
|
|
80590
80598
|
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
80591
80599
|
// an `Awaited<T | U>` would suffice.
|
|
80592
|
-
return
|
|
80600
|
+
return getGlobalTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
80593
80601
|
}
|
|
80594
80602
|
}
|
|
80595
80603
|
}
|
|
@@ -127640,20 +127648,6 @@ var ts;
|
|
|
127640
127648
|
return !!location.parent && ts.isImportOrExportSpecifier(location.parent) && location.parent.propertyName === location;
|
|
127641
127649
|
}
|
|
127642
127650
|
ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName;
|
|
127643
|
-
/**
|
|
127644
|
-
* Returns true if `node` is the declaration of `n` in:
|
|
127645
|
-
* - `import n from "m"`
|
|
127646
|
-
* - `import * as n from "m"`
|
|
127647
|
-
* - `import n = require("m")`
|
|
127648
|
-
* - `const n = require("m")`
|
|
127649
|
-
*/
|
|
127650
|
-
function isFreelyNameableImport(node) {
|
|
127651
|
-
return node.kind === 266 /* ImportClause */
|
|
127652
|
-
|| node.kind === 267 /* NamespaceImport */
|
|
127653
|
-
|| ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)
|
|
127654
|
-
|| ts.isVariableDeclarationInitializedToRequire(node);
|
|
127655
|
-
}
|
|
127656
|
-
ts.isFreelyNameableImport = isFreelyNameableImport;
|
|
127657
127651
|
function getScriptKind(fileName, host) {
|
|
127658
127652
|
// First check to see if the script kind was specified by the host. Chances are the host
|
|
127659
127653
|
// may override the default script kind for the file extension.
|
|
@@ -136668,29 +136662,6 @@ var ts;
|
|
|
136668
136662
|
}
|
|
136669
136663
|
}
|
|
136670
136664
|
Core.eachSymbolReferenceInFile = eachSymbolReferenceInFile;
|
|
136671
|
-
function getTopMostDeclarationNamesInFile(declarationName, sourceFile) {
|
|
136672
|
-
var candidates = ts.filter(getPossibleSymbolReferenceNodes(sourceFile, declarationName), function (name) { return !!ts.getDeclarationFromName(name); });
|
|
136673
|
-
return candidates.reduce(function (topMost, decl) {
|
|
136674
|
-
var depth = getDepth(decl);
|
|
136675
|
-
if (!ts.some(topMost.declarationNames) || depth === topMost.depth) {
|
|
136676
|
-
topMost.declarationNames.push(decl);
|
|
136677
|
-
}
|
|
136678
|
-
else if (depth < topMost.depth) {
|
|
136679
|
-
topMost.declarationNames = [decl];
|
|
136680
|
-
}
|
|
136681
|
-
topMost.depth = depth;
|
|
136682
|
-
return topMost;
|
|
136683
|
-
}, { depth: Infinity, declarationNames: [] }).declarationNames;
|
|
136684
|
-
function getDepth(declaration) {
|
|
136685
|
-
var depth = 0;
|
|
136686
|
-
while (declaration) {
|
|
136687
|
-
declaration = ts.getContainerNode(declaration);
|
|
136688
|
-
depth++;
|
|
136689
|
-
}
|
|
136690
|
-
return depth;
|
|
136691
|
-
}
|
|
136692
|
-
}
|
|
136693
|
-
Core.getTopMostDeclarationNamesInFile = getTopMostDeclarationNamesInFile;
|
|
136694
136665
|
function someSignatureUsage(signature, sourceFiles, checker, cb) {
|
|
136695
136666
|
if (!signature.name || !ts.isIdentifier(signature.name))
|
|
136696
136667
|
return false;
|
|
@@ -138323,9 +138294,7 @@ var ts;
|
|
|
138323
138294
|
(function (ts) {
|
|
138324
138295
|
var GoToDefinition;
|
|
138325
138296
|
(function (GoToDefinition) {
|
|
138326
|
-
function getDefinitionAtPosition(program, sourceFile, position
|
|
138327
|
-
var _a;
|
|
138328
|
-
var _b;
|
|
138297
|
+
function getDefinitionAtPosition(program, sourceFile, position) {
|
|
138329
138298
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
138330
138299
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
138331
138300
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -138348,50 +138317,17 @@ var ts;
|
|
|
138348
138317
|
}
|
|
138349
138318
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138350
138319
|
var classDecl = node.parent.parent;
|
|
138351
|
-
var
|
|
138352
|
-
if (aliasesOnly && !isAliasTarget_1)
|
|
138353
|
-
return undefined;
|
|
138320
|
+
var symbol_1 = getSymbol(classDecl, typeChecker);
|
|
138354
138321
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138355
138322
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138356
138323
|
var sourceFile_1 = node.getSourceFile();
|
|
138357
138324
|
return ts.map(staticBlocks, function (staticBlock) {
|
|
138358
138325
|
var pos = ts.moveRangePastModifiers(staticBlock).pos;
|
|
138359
138326
|
pos = ts.skipTrivia(sourceFile_1.text, pos);
|
|
138360
|
-
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1,
|
|
138327
|
+
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, { start: pos, length: "static".length });
|
|
138361
138328
|
});
|
|
138362
138329
|
}
|
|
138363
|
-
var
|
|
138364
|
-
var fallbackNode = node;
|
|
138365
|
-
if (aliasesOnly && failedAliasResolution) {
|
|
138366
|
-
// We couldn't resolve the specific import, try on the module specifier.
|
|
138367
|
-
var importDeclaration = ts.findAncestor(node, ts.isAnyImportOrBareOrAccessedRequire);
|
|
138368
|
-
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138369
|
-
if (moduleSpecifier) {
|
|
138370
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, isAliasTarget = _a.isAliasTarget, failedAliasResolution = _a.failedAliasResolution);
|
|
138371
|
-
fallbackNode = moduleSpecifier;
|
|
138372
|
-
}
|
|
138373
|
-
}
|
|
138374
|
-
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
138375
|
-
// We couldn't resolve the module specifier as an external module, but it could
|
|
138376
|
-
// be that module resolution succeeded but the target was not a module.
|
|
138377
|
-
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
138378
|
-
if (ref) {
|
|
138379
|
-
return [{
|
|
138380
|
-
name: fallbackNode.text,
|
|
138381
|
-
fileName: ref.resolvedFileName,
|
|
138382
|
-
containerName: undefined,
|
|
138383
|
-
containerKind: undefined,
|
|
138384
|
-
kind: "script" /* scriptElement */,
|
|
138385
|
-
textSpan: ts.createTextSpan(0, 0),
|
|
138386
|
-
isAliasTarget: true,
|
|
138387
|
-
failedAliasResolution: failedAliasResolution,
|
|
138388
|
-
isAmbient: ts.isDeclarationFileName(ref.resolvedFileName),
|
|
138389
|
-
unverified: fallbackNode !== node,
|
|
138390
|
-
}];
|
|
138391
|
-
}
|
|
138392
|
-
}
|
|
138393
|
-
if (aliasesOnly && !isAliasTarget)
|
|
138394
|
-
return undefined;
|
|
138330
|
+
var symbol = getSymbol(node, typeChecker);
|
|
138395
138331
|
// Could not find a symbol e.g. node is string or number keyword,
|
|
138396
138332
|
// or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol
|
|
138397
138333
|
if (!symbol) {
|
|
@@ -138400,14 +138336,14 @@ var ts;
|
|
|
138400
138336
|
var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
138401
138337
|
// Don't go to the component constructor definition for a JSX element, just go to the component definition.
|
|
138402
138338
|
if (calledDeclaration && !(ts.isJsxOpeningLikeElement(node.parent) && isConstructorLike(calledDeclaration))) {
|
|
138403
|
-
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration
|
|
138339
|
+
var sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration);
|
|
138404
138340
|
// For a function, if this is the original function definition, return just sigInfo.
|
|
138405
138341
|
// If this is the original constructor definition, parent is the class.
|
|
138406
138342
|
if (typeChecker.getRootSymbols(symbol).some(function (s) { return symbolMatchesSignature(s, calledDeclaration); })) {
|
|
138407
138343
|
return [sigInfo];
|
|
138408
138344
|
}
|
|
138409
138345
|
else {
|
|
138410
|
-
var defs = getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
138346
|
+
var defs = getDefinitionFromSymbol(typeChecker, symbol, node, calledDeclaration) || ts.emptyArray;
|
|
138411
138347
|
// For a 'super()' call, put the signature first, else put the variable first.
|
|
138412
138348
|
return node.kind === 106 /* SuperKeyword */ ? __spreadArray([sigInfo], defs, true) : __spreadArray(__spreadArray([], defs, true), [sigInfo], false);
|
|
138413
138349
|
}
|
|
@@ -138419,7 +138355,7 @@ var ts;
|
|
|
138419
138355
|
// assignment. This case and others are handled by the following code.
|
|
138420
138356
|
if (node.parent.kind === 296 /* ShorthandPropertyAssignment */) {
|
|
138421
138357
|
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
|
|
138422
|
-
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
|
|
138358
|
+
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;
|
|
138423
138359
|
return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray);
|
|
138424
138360
|
}
|
|
138425
138361
|
// If the node is the name of a BindingElement within an ObjectBindingPattern instead of just returning the
|
|
@@ -138442,7 +138378,7 @@ var ts;
|
|
|
138442
138378
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
138443
138379
|
});
|
|
138444
138380
|
}
|
|
138445
|
-
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node
|
|
138381
|
+
return ts.concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node));
|
|
138446
138382
|
}
|
|
138447
138383
|
GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition;
|
|
138448
138384
|
/**
|
|
@@ -138540,24 +138476,24 @@ var ts;
|
|
|
138540
138476
|
return undefined;
|
|
138541
138477
|
}
|
|
138542
138478
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138543
|
-
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent
|
|
138479
|
+
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent);
|
|
138544
138480
|
}
|
|
138545
|
-
var
|
|
138481
|
+
var symbol = getSymbol(node, typeChecker);
|
|
138546
138482
|
if (!symbol)
|
|
138547
138483
|
return undefined;
|
|
138548
138484
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
138549
138485
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
138550
|
-
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node
|
|
138486
|
+
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
138551
138487
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
138552
|
-
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node
|
|
138488
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
138553
138489
|
return typeDefinitions.length ? typeDefinitions
|
|
138554
|
-
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node
|
|
138490
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
138555
138491
|
: undefined;
|
|
138556
138492
|
}
|
|
138557
138493
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
138558
|
-
function definitionFromType(type, checker, node
|
|
138494
|
+
function definitionFromType(type, checker, node) {
|
|
138559
138495
|
return ts.flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], function (t) {
|
|
138560
|
-
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node
|
|
138496
|
+
return t.symbol && getDefinitionFromSymbol(checker, t.symbol, node);
|
|
138561
138497
|
});
|
|
138562
138498
|
}
|
|
138563
138499
|
function tryGetReturnTypeOfFunction(symbol, type, checker) {
|
|
@@ -138572,8 +138508,8 @@ var ts;
|
|
|
138572
138508
|
}
|
|
138573
138509
|
return undefined;
|
|
138574
138510
|
}
|
|
138575
|
-
function getDefinitionAndBoundSpan(program, sourceFile, position
|
|
138576
|
-
var definitions = getDefinitionAtPosition(program, sourceFile, position
|
|
138511
|
+
function getDefinitionAndBoundSpan(program, sourceFile, position) {
|
|
138512
|
+
var definitions = getDefinitionAtPosition(program, sourceFile, position);
|
|
138577
138513
|
if (!definitions || definitions.length === 0) {
|
|
138578
138514
|
return undefined;
|
|
138579
138515
|
}
|
|
@@ -138599,17 +138535,13 @@ var ts;
|
|
|
138599
138535
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
138600
138536
|
// import {A, B} from "mod";
|
|
138601
138537
|
// to jump to the implementation directly.
|
|
138602
|
-
var failedAliasResolution = false;
|
|
138603
138538
|
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
138604
138539
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
138605
138540
|
if (aliased.declarations) {
|
|
138606
|
-
return
|
|
138607
|
-
}
|
|
138608
|
-
else {
|
|
138609
|
-
failedAliasResolution = true;
|
|
138541
|
+
return aliased;
|
|
138610
138542
|
}
|
|
138611
138543
|
}
|
|
138612
|
-
return
|
|
138544
|
+
return symbol;
|
|
138613
138545
|
}
|
|
138614
138546
|
// Go to the original declaration for cases:
|
|
138615
138547
|
//
|
|
@@ -138623,45 +138555,26 @@ var ts;
|
|
|
138623
138555
|
if (node.parent === declaration) {
|
|
138624
138556
|
return true;
|
|
138625
138557
|
}
|
|
138626
|
-
|
|
138627
|
-
|
|
138628
|
-
|
|
138629
|
-
return true;
|
|
138630
|
-
}
|
|
138631
|
-
/**
|
|
138632
|
-
* ```ts
|
|
138633
|
-
* function f() {}
|
|
138634
|
-
* f.foo = 0;
|
|
138635
|
-
* ```
|
|
138636
|
-
*
|
|
138637
|
-
* Here, `f` has two declarations: the function declaration, and the identifier in the next line.
|
|
138638
|
-
* The latter is a declaration for `f` because it gives `f` the `SymbolFlags.Namespace` meaning so
|
|
138639
|
-
* it can contain `foo`. However, that declaration is pretty uninteresting and not intuitively a
|
|
138640
|
-
* "definition" for `f`. Ideally, the question we'd like to answer is "what SymbolFlags does this
|
|
138641
|
-
* declaration contribute to the symbol for `f`?" If the answer is just `Namespace` and the
|
|
138642
|
-
* declaration looks like an assignment, that declaration is in no sense a definition for `f`.
|
|
138643
|
-
* But that information is totally lost during binding and/or symbol merging, so we need to do
|
|
138644
|
-
* our best to reconstruct it or use other heuristics. This function (and the logic around its
|
|
138645
|
-
* calling) covers our tests but feels like a hack, and it would be great if someone could come
|
|
138646
|
-
* up with a more precise definition of what counts as a definition.
|
|
138647
|
-
*/
|
|
138648
|
-
function isExpandoDeclaration(node) {
|
|
138649
|
-
if (!ts.isAssignmentDeclaration(node))
|
|
138650
|
-
return false;
|
|
138651
|
-
var containingAssignment = ts.findAncestor(node, function (p) {
|
|
138652
|
-
if (ts.isAssignmentExpression(p))
|
|
138558
|
+
switch (declaration.kind) {
|
|
138559
|
+
case 266 /* ImportClause */:
|
|
138560
|
+
case 264 /* ImportEqualsDeclaration */:
|
|
138653
138561
|
return true;
|
|
138654
|
-
|
|
138655
|
-
return
|
|
138656
|
-
|
|
138657
|
-
|
|
138658
|
-
|
|
138562
|
+
case 269 /* ImportSpecifier */:
|
|
138563
|
+
return declaration.parent.kind === 268 /* NamedImports */;
|
|
138564
|
+
case 202 /* BindingElement */:
|
|
138565
|
+
case 253 /* VariableDeclaration */:
|
|
138566
|
+
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
138567
|
+
default:
|
|
138568
|
+
return false;
|
|
138569
|
+
}
|
|
138659
138570
|
}
|
|
138660
|
-
function getDefinitionFromSymbol(typeChecker, symbol, node,
|
|
138661
|
-
|
|
138662
|
-
|
|
138663
|
-
|
|
138664
|
-
|
|
138571
|
+
function getDefinitionFromSymbol(typeChecker, symbol, node, declarationNode) {
|
|
138572
|
+
// There are cases when you extend a function by adding properties to it afterwards,
|
|
138573
|
+
// we want to strip those extra properties.
|
|
138574
|
+
// For deduping purposes, we also want to exclude any declarationNodes if provided.
|
|
138575
|
+
var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== declarationNode && (!ts.isAssignmentDeclaration(d) || d === symbol.valueDeclaration); })
|
|
138576
|
+
|| undefined;
|
|
138577
|
+
return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(filteredDeclarations, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node); });
|
|
138665
138578
|
function getConstructSignatureDefinition() {
|
|
138666
138579
|
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
|
138667
138580
|
// and in either case the symbol has a construct signature definition, i.e. class
|
|
@@ -138685,27 +138598,26 @@ var ts;
|
|
|
138685
138598
|
return declarations.length
|
|
138686
138599
|
? declarationsWithBody.length !== 0
|
|
138687
138600
|
? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); })
|
|
138688
|
-
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node
|
|
138601
|
+
: [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node)]
|
|
138689
138602
|
: undefined;
|
|
138690
138603
|
}
|
|
138691
138604
|
}
|
|
138692
138605
|
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
|
138693
|
-
function createDefinitionInfo(declaration, checker, symbol, node
|
|
138606
|
+
function createDefinitionInfo(declaration, checker, symbol, node) {
|
|
138694
138607
|
var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
|
138695
138608
|
var symbolKind = ts.SymbolDisplay.getSymbolKind(checker, symbol, node);
|
|
138696
138609
|
var containerName = symbol.parent ? checker.symbolToString(symbol.parent, node) : "";
|
|
138697
|
-
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName
|
|
138610
|
+
return createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName);
|
|
138698
138611
|
}
|
|
138699
|
-
GoToDefinition.createDefinitionInfo = createDefinitionInfo;
|
|
138700
138612
|
/** Creates a DefinitionInfo directly from the name of a declaration. */
|
|
138701
|
-
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName,
|
|
138613
|
+
function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolName, containerName, textSpan) {
|
|
138702
138614
|
var sourceFile = declaration.getSourceFile();
|
|
138703
138615
|
if (!textSpan) {
|
|
138704
138616
|
var name = ts.getNameOfDeclaration(declaration) || declaration;
|
|
138705
138617
|
textSpan = ts.createTextSpanFromNode(name, sourceFile);
|
|
138706
138618
|
}
|
|
138707
138619
|
return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217
|
|
138708
|
-
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration)
|
|
138620
|
+
containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) });
|
|
138709
138621
|
}
|
|
138710
138622
|
function isDefinitionVisible(checker, declaration) {
|
|
138711
138623
|
if (checker.isDeclarationVisible(declaration))
|
|
@@ -138738,8 +138650,8 @@ var ts;
|
|
|
138738
138650
|
return false;
|
|
138739
138651
|
}
|
|
138740
138652
|
}
|
|
138741
|
-
function createDefinitionFromSignatureDeclaration(typeChecker, decl
|
|
138742
|
-
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl
|
|
138653
|
+
function createDefinitionFromSignatureDeclaration(typeChecker, decl) {
|
|
138654
|
+
return createDefinitionInfo(decl, typeChecker, decl.symbol, decl);
|
|
138743
138655
|
}
|
|
138744
138656
|
function findReferenceInPosition(refs, pos) {
|
|
138745
138657
|
return ts.find(refs, function (ref) { return ts.textRangeContainsPositionInclusive(ref, pos); });
|
|
@@ -138754,7 +138666,6 @@ var ts;
|
|
|
138754
138666
|
containerName: undefined,
|
|
138755
138667
|
containerKind: undefined,
|
|
138756
138668
|
unverified: unverified,
|
|
138757
|
-
isAliasTarget: true,
|
|
138758
138669
|
};
|
|
138759
138670
|
}
|
|
138760
138671
|
/** Returns a CallLikeExpression where `node` is the target being invoked. */
|
|
@@ -141808,6 +141719,41 @@ var ts;
|
|
|
141808
141719
|
if (ts.scanner.getToken() === 1 /* EndOfFileToken */) {
|
|
141809
141720
|
break;
|
|
141810
141721
|
}
|
|
141722
|
+
if (ts.scanner.getToken() === 15 /* TemplateHead */) {
|
|
141723
|
+
var stack = [ts.scanner.getToken()];
|
|
141724
|
+
var token = ts.scanner.scan();
|
|
141725
|
+
loop: while (ts.length(stack)) {
|
|
141726
|
+
switch (token) {
|
|
141727
|
+
case 1 /* EndOfFileToken */:
|
|
141728
|
+
break loop;
|
|
141729
|
+
case 100 /* ImportKeyword */:
|
|
141730
|
+
tryConsumeImport();
|
|
141731
|
+
break;
|
|
141732
|
+
case 15 /* TemplateHead */:
|
|
141733
|
+
stack.push(token);
|
|
141734
|
+
break;
|
|
141735
|
+
case 18 /* OpenBraceToken */:
|
|
141736
|
+
if (ts.length(stack)) {
|
|
141737
|
+
stack.push(token);
|
|
141738
|
+
}
|
|
141739
|
+
break;
|
|
141740
|
+
case 19 /* CloseBraceToken */:
|
|
141741
|
+
if (ts.length(stack)) {
|
|
141742
|
+
if (ts.lastOrUndefined(stack) === 15 /* TemplateHead */) {
|
|
141743
|
+
if (ts.scanner.reScanTemplateToken(/* isTaggedTemplate */ false) === 17 /* TemplateTail */) {
|
|
141744
|
+
stack.pop();
|
|
141745
|
+
}
|
|
141746
|
+
}
|
|
141747
|
+
else {
|
|
141748
|
+
stack.pop();
|
|
141749
|
+
}
|
|
141750
|
+
}
|
|
141751
|
+
break;
|
|
141752
|
+
}
|
|
141753
|
+
token = ts.scanner.scan();
|
|
141754
|
+
}
|
|
141755
|
+
nextToken();
|
|
141756
|
+
}
|
|
141811
141757
|
// check if at least one of alternative have moved scanner forward
|
|
141812
141758
|
if (tryConsumeDeclare() ||
|
|
141813
141759
|
tryConsumeImport() ||
|
|
@@ -143101,7 +143047,7 @@ var ts;
|
|
|
143101
143047
|
if (!typeDisplayString) {
|
|
143102
143048
|
continue;
|
|
143103
143049
|
}
|
|
143104
|
-
addTypeHints(typeDisplayString, param.name.end);
|
|
143050
|
+
addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
|
|
143105
143051
|
}
|
|
143106
143052
|
}
|
|
143107
143053
|
function getParameterDeclarationTypeDisplayString(symbol) {
|
|
@@ -151753,10 +151699,9 @@ var ts;
|
|
|
151753
151699
|
// 2. add "member3" to the second import statement's import list
|
|
151754
151700
|
// and it is up to the user to decide which one fits best.
|
|
151755
151701
|
return ts.firstDefined(existingImports, function (_a) {
|
|
151756
|
-
var _b;
|
|
151757
151702
|
var declaration = _a.declaration;
|
|
151758
151703
|
var namespacePrefix = getNamespaceLikeImportText(declaration);
|
|
151759
|
-
var moduleSpecifier =
|
|
151704
|
+
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
151760
151705
|
if (namespacePrefix && moduleSpecifier) {
|
|
151761
151706
|
var moduleSymbol = getTargetModuleFromNamespaceLikeImport(declaration, checker);
|
|
151762
151707
|
if (moduleSymbol && moduleSymbol.exports.has(ts.escapeLeadingUnderscores(symbolName))) {
|
|
@@ -151932,9 +151877,8 @@ var ts;
|
|
|
151932
151877
|
return existingDeclaration ? [existingDeclaration] : getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences).fixes;
|
|
151933
151878
|
}
|
|
151934
151879
|
function newImportInfoFromExistingSpecifier(_a, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) {
|
|
151935
|
-
var _b;
|
|
151936
151880
|
var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags;
|
|
151937
|
-
var moduleSpecifier =
|
|
151881
|
+
var moduleSpecifier = ts.tryGetModuleSpecifierFromDeclaration(declaration);
|
|
151938
151882
|
if (moduleSpecifier) {
|
|
151939
151883
|
var addAsTypeOnly = useRequire
|
|
151940
151884
|
? 4 /* NotAllowed */
|
|
@@ -163743,9 +163687,9 @@ var ts;
|
|
|
163743
163687
|
synchronizeHostData();
|
|
163744
163688
|
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position);
|
|
163745
163689
|
}
|
|
163746
|
-
function getDefinitionAndBoundSpan(fileName, position
|
|
163690
|
+
function getDefinitionAndBoundSpan(fileName, position) {
|
|
163747
163691
|
synchronizeHostData();
|
|
163748
|
-
return ts.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position
|
|
163692
|
+
return ts.GoToDefinition.getDefinitionAndBoundSpan(program, getValidSourceFile(fileName), position);
|
|
163749
163693
|
}
|
|
163750
163694
|
function getTypeDefinitionAtPosition(fileName, position) {
|
|
163751
163695
|
synchronizeHostData();
|