@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/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220316";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -8023,7 +8023,7 @@ var ts;
|
|
|
8023
8023
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
8024
8024
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
8025
8025
|
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."),
|
|
8026
|
-
|
|
8026
|
+
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."),
|
|
8027
8027
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
8028
8028
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
8029
8029
|
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."),
|
|
@@ -14939,10 +14939,6 @@ var ts;
|
|
|
14939
14939
|
}
|
|
14940
14940
|
}
|
|
14941
14941
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14942
|
-
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14943
|
-
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14944
|
-
}
|
|
14945
|
-
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14946
14942
|
function isLateVisibilityPaintedStatement(node) {
|
|
14947
14943
|
switch (node.kind) {
|
|
14948
14944
|
case 265 /* ImportDeclaration */:
|
|
@@ -16521,14 +16517,14 @@ var ts;
|
|
|
16521
16517
|
}
|
|
16522
16518
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16523
16519
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16524
|
-
var _a, _b;
|
|
16520
|
+
var _a, _b, _c;
|
|
16525
16521
|
switch (node.kind) {
|
|
16526
16522
|
case 253 /* VariableDeclaration */:
|
|
16527
|
-
return
|
|
16523
|
+
return node.initializer.arguments[0].text;
|
|
16528
16524
|
case 265 /* ImportDeclaration */:
|
|
16529
|
-
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16525
|
+
return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
|
|
16530
16526
|
case 264 /* ImportEqualsDeclaration */:
|
|
16531
|
-
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16527
|
+
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;
|
|
16532
16528
|
default:
|
|
16533
16529
|
ts.Debug.assertNever(node);
|
|
16534
16530
|
}
|
|
@@ -17055,28 +17051,21 @@ var ts;
|
|
|
17055
17051
|
// export = <EntityNameExpression>
|
|
17056
17052
|
// export default <EntityNameExpression>
|
|
17057
17053
|
// module.exports = <EntityNameExpression>
|
|
17058
|
-
//
|
|
17059
|
-
//
|
|
17060
|
-
// const { x } = require("...")
|
|
17061
|
-
// const x = require("...").y
|
|
17062
|
-
// const { x } = require("...").y
|
|
17054
|
+
// {<Identifier>}
|
|
17055
|
+
// {name: <EntityNameExpression>}
|
|
17063
17056
|
function isAliasSymbolDeclaration(node) {
|
|
17064
|
-
|
|
17057
|
+
return node.kind === 264 /* ImportEqualsDeclaration */ ||
|
|
17065
17058
|
node.kind === 263 /* NamespaceExportDeclaration */ ||
|
|
17066
17059
|
node.kind === 266 /* ImportClause */ && !!node.name ||
|
|
17067
17060
|
node.kind === 267 /* NamespaceImport */ ||
|
|
17068
17061
|
node.kind === 273 /* NamespaceExport */ ||
|
|
17069
17062
|
node.kind === 269 /* ImportSpecifier */ ||
|
|
17070
17063
|
node.kind === 274 /* ExportSpecifier */ ||
|
|
17071
|
-
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
&& ts.isBinaryExpression(node.parent)
|
|
17077
|
-
&& node.parent.left === node
|
|
17078
|
-
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17079
|
-
&& isAliasableExpression(node.parent.right));
|
|
17064
|
+
node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
|
|
17065
|
+
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17066
|
+
ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right) ||
|
|
17067
|
+
node.kind === 296 /* ShorthandPropertyAssignment */ ||
|
|
17068
|
+
node.kind === 295 /* PropertyAssignment */ && isAliasableExpression(node.initializer);
|
|
17080
17069
|
}
|
|
17081
17070
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17082
17071
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17087,7 +17076,6 @@ var ts;
|
|
|
17087
17076
|
case 274 /* ExportSpecifier */:
|
|
17088
17077
|
case 270 /* ExportAssignment */:
|
|
17089
17078
|
case 264 /* ImportEqualsDeclaration */:
|
|
17090
|
-
case 273 /* NamespaceExport */:
|
|
17091
17079
|
return node.parent;
|
|
17092
17080
|
case 160 /* QualifiedName */:
|
|
17093
17081
|
do {
|
|
@@ -31427,20 +31415,23 @@ var ts;
|
|
|
31427
31415
|
return inContext(32768 /* AwaitContext */);
|
|
31428
31416
|
}
|
|
31429
31417
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
31430
|
-
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31418
|
+
return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
31431
31419
|
}
|
|
31432
31420
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
31433
31421
|
// Don't report another error if it would just be at the same position as the last error.
|
|
31434
31422
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
31423
|
+
var result;
|
|
31435
31424
|
if (!lastError || start !== lastError.start) {
|
|
31436
|
-
|
|
31425
|
+
result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
|
|
31426
|
+
parseDiagnostics.push(result);
|
|
31437
31427
|
}
|
|
31438
31428
|
// Mark that we've encountered an error. We'll set an appropriate bit on the next
|
|
31439
31429
|
// node we finish so that it can't be reused incrementally.
|
|
31440
31430
|
parseErrorBeforeNextFinishedNode = true;
|
|
31431
|
+
return result;
|
|
31441
31432
|
}
|
|
31442
31433
|
function parseErrorAt(start, end, message, arg0) {
|
|
31443
|
-
parseErrorAtPosition(start, end - start, message, arg0);
|
|
31434
|
+
return parseErrorAtPosition(start, end - start, message, arg0);
|
|
31444
31435
|
}
|
|
31445
31436
|
function parseErrorAtRange(range, message, arg0) {
|
|
31446
31437
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -31713,6 +31704,19 @@ var ts;
|
|
|
31713
31704
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
31714
31705
|
return false;
|
|
31715
31706
|
}
|
|
31707
|
+
function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
|
|
31708
|
+
if (token() === closeKind) {
|
|
31709
|
+
nextToken();
|
|
31710
|
+
return;
|
|
31711
|
+
}
|
|
31712
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
31713
|
+
if (!openParsed) {
|
|
31714
|
+
return;
|
|
31715
|
+
}
|
|
31716
|
+
if (lastError) {
|
|
31717
|
+
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)));
|
|
31718
|
+
}
|
|
31719
|
+
}
|
|
31716
31720
|
function parseOptional(t) {
|
|
31717
31721
|
if (token() === t) {
|
|
31718
31722
|
nextToken();
|
|
@@ -33361,7 +33365,7 @@ var ts;
|
|
|
33361
33365
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
33362
33366
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
33363
33367
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
33364
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
33368
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
33365
33369
|
}
|
|
33366
33370
|
}
|
|
33367
33371
|
return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
@@ -35171,10 +35175,11 @@ var ts;
|
|
|
35171
35175
|
}
|
|
35172
35176
|
function parseArrayLiteralExpression() {
|
|
35173
35177
|
var pos = getNodePos();
|
|
35174
|
-
|
|
35178
|
+
var openBracketPosition = scanner.getTokenPos();
|
|
35179
|
+
var openBracketParsed = parseExpected(22 /* OpenBracketToken */);
|
|
35175
35180
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35176
35181
|
var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
35177
|
-
|
|
35182
|
+
parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
|
|
35178
35183
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
35179
35184
|
}
|
|
35180
35185
|
function parseObjectLiteralElement() {
|
|
@@ -35231,15 +35236,10 @@ var ts;
|
|
|
35231
35236
|
function parseObjectLiteralExpression() {
|
|
35232
35237
|
var pos = getNodePos();
|
|
35233
35238
|
var openBracePosition = scanner.getTokenPos();
|
|
35234
|
-
parseExpected(18 /* OpenBraceToken */);
|
|
35239
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */);
|
|
35235
35240
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35236
35241
|
var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
|
|
35237
|
-
|
|
35238
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35239
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35240
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35241
|
-
}
|
|
35242
|
-
}
|
|
35242
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35243
35243
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
35244
35244
|
}
|
|
35245
35245
|
function parseFunctionExpression() {
|
|
@@ -35295,15 +35295,11 @@ var ts;
|
|
|
35295
35295
|
var pos = getNodePos();
|
|
35296
35296
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35297
35297
|
var openBracePosition = scanner.getTokenPos();
|
|
35298
|
-
|
|
35298
|
+
var openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
|
|
35299
|
+
if (openBraceParsed || ignoreMissingOpenBrace) {
|
|
35299
35300
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
35300
35301
|
var statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
35301
|
-
|
|
35302
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35303
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
35304
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
35305
|
-
}
|
|
35306
|
-
}
|
|
35302
|
+
parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
|
|
35307
35303
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
35308
35304
|
if (token() === 63 /* EqualsToken */) {
|
|
35309
35305
|
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);
|
|
@@ -35348,9 +35344,10 @@ var ts;
|
|
|
35348
35344
|
var pos = getNodePos();
|
|
35349
35345
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35350
35346
|
parseExpected(99 /* IfKeyword */);
|
|
35351
|
-
|
|
35347
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35348
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35352
35349
|
var expression = allowInAnd(parseExpression);
|
|
35353
|
-
|
|
35350
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35354
35351
|
var thenStatement = parseStatement();
|
|
35355
35352
|
var elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : undefined;
|
|
35356
35353
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -35361,9 +35358,10 @@ var ts;
|
|
|
35361
35358
|
parseExpected(90 /* DoKeyword */);
|
|
35362
35359
|
var statement = parseStatement();
|
|
35363
35360
|
parseExpected(115 /* WhileKeyword */);
|
|
35364
|
-
|
|
35361
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35362
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35365
35363
|
var expression = allowInAnd(parseExpression);
|
|
35366
|
-
|
|
35364
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35367
35365
|
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
|
|
35368
35366
|
// 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
|
|
35369
35367
|
// spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
|
|
@@ -35375,9 +35373,10 @@ var ts;
|
|
|
35375
35373
|
var pos = getNodePos();
|
|
35376
35374
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35377
35375
|
parseExpected(115 /* WhileKeyword */);
|
|
35378
|
-
|
|
35376
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35377
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35379
35378
|
var expression = allowInAnd(parseExpression);
|
|
35380
|
-
|
|
35379
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35381
35380
|
var statement = parseStatement();
|
|
35382
35381
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
35383
35382
|
}
|
|
@@ -35444,9 +35443,10 @@ var ts;
|
|
|
35444
35443
|
var pos = getNodePos();
|
|
35445
35444
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35446
35445
|
parseExpected(116 /* WithKeyword */);
|
|
35447
|
-
|
|
35446
|
+
var openParenPosition = scanner.getTokenPos();
|
|
35447
|
+
var openParenParsed = parseExpected(20 /* OpenParenToken */);
|
|
35448
35448
|
var expression = allowInAnd(parseExpression);
|
|
35449
|
-
|
|
35449
|
+
parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
|
|
35450
35450
|
var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
|
|
35451
35451
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
35452
35452
|
}
|
|
@@ -36580,7 +36580,7 @@ var ts;
|
|
|
36580
36580
|
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
36581
36581
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
36582
36582
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
36583
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
36583
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
36584
36584
|
}
|
|
36585
36585
|
}
|
|
36586
36586
|
return finishNode(factory.createAssertClause(elements, multiLine), pos);
|
|
@@ -37556,8 +37556,7 @@ var ts;
|
|
|
37556
37556
|
hasChildren = true;
|
|
37557
37557
|
if (child.kind === 342 /* JSDocTypeTag */) {
|
|
37558
37558
|
if (childTypeTag) {
|
|
37559
|
-
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37560
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
37559
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37561
37560
|
if (lastError) {
|
|
37562
37561
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
37563
37562
|
}
|
|
@@ -39435,13 +39434,6 @@ var ts;
|
|
|
39435
39434
|
description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
|
|
39436
39435
|
defaultValueDescription: false,
|
|
39437
39436
|
},
|
|
39438
|
-
{
|
|
39439
|
-
name: "noDtsResolution",
|
|
39440
|
-
type: "boolean",
|
|
39441
|
-
affectsModuleResolution: true,
|
|
39442
|
-
category: ts.Diagnostics.Modules,
|
|
39443
|
-
defaultValueDescription: false,
|
|
39444
|
-
},
|
|
39445
39437
|
// Source Maps
|
|
39446
39438
|
{
|
|
39447
39439
|
name: "sourceRoot",
|
|
@@ -41821,8 +41813,7 @@ var ts;
|
|
|
41821
41813
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
41822
41814
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
41823
41815
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
41824
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
41825
|
-
Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
|
|
41816
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
|
|
41826
41817
|
})(Extensions || (Extensions = {}));
|
|
41827
41818
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
41828
41819
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -42767,21 +42758,7 @@ var ts;
|
|
|
42767
42758
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
42768
42759
|
}
|
|
42769
42760
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
42770
|
-
|
|
42771
|
-
if (lookupConfig) {
|
|
42772
|
-
extensions = tsconfigExtensions;
|
|
42773
|
-
}
|
|
42774
|
-
else if (compilerOptions.noDtsResolution) {
|
|
42775
|
-
extensions = [Extensions.TypeScriptButNotDts];
|
|
42776
|
-
if (compilerOptions.allowJs)
|
|
42777
|
-
extensions.push(Extensions.JavaScript);
|
|
42778
|
-
if (compilerOptions.resolveJsonModule)
|
|
42779
|
-
extensions.push(Extensions.Json);
|
|
42780
|
-
}
|
|
42781
|
-
else {
|
|
42782
|
-
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
42783
|
-
}
|
|
42784
|
-
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
42761
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
42785
42762
|
}
|
|
42786
42763
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
42787
42764
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -42790,10 +42767,6 @@ var ts;
|
|
|
42790
42767
|
var failedLookupLocations = [];
|
|
42791
42768
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
42792
42769
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
42793
|
-
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
42794
|
-
if (compilerOptions.noDtsResolution) {
|
|
42795
|
-
conditions.pop();
|
|
42796
|
-
}
|
|
42797
42770
|
var state = {
|
|
42798
42771
|
compilerOptions: compilerOptions,
|
|
42799
42772
|
host: host,
|
|
@@ -42801,7 +42774,7 @@ var ts;
|
|
|
42801
42774
|
failedLookupLocations: failedLookupLocations,
|
|
42802
42775
|
packageJsonInfoCache: cache,
|
|
42803
42776
|
features: features,
|
|
42804
|
-
conditions:
|
|
42777
|
+
conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
|
|
42805
42778
|
};
|
|
42806
42779
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
42807
42780
|
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);
|
|
@@ -43009,22 +42982,20 @@ var ts;
|
|
|
43009
42982
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43010
42983
|
}
|
|
43011
42984
|
case Extensions.TypeScript:
|
|
43012
|
-
case Extensions.TypeScriptButNotDts:
|
|
43013
|
-
var useDts = extensions === Extensions.TypeScript;
|
|
43014
42985
|
switch (originalExtension) {
|
|
43015
42986
|
case ".mjs" /* Mjs */:
|
|
43016
42987
|
case ".mts" /* Mts */:
|
|
43017
42988
|
case ".d.mts" /* Dmts */:
|
|
43018
|
-
return tryExtension(".mts" /* Mts */) ||
|
|
42989
|
+
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43019
42990
|
case ".cjs" /* Cjs */:
|
|
43020
42991
|
case ".cts" /* Cts */:
|
|
43021
42992
|
case ".d.cts" /* Dcts */:
|
|
43022
|
-
return tryExtension(".cts" /* Cts */) ||
|
|
42993
|
+
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43023
42994
|
case ".json" /* Json */:
|
|
43024
42995
|
candidate += ".json" /* Json */;
|
|
43025
|
-
return
|
|
42996
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
43026
42997
|
default:
|
|
43027
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) ||
|
|
42998
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43028
42999
|
}
|
|
43029
43000
|
case Extensions.JavaScript:
|
|
43030
43001
|
switch (originalExtension) {
|
|
@@ -43242,7 +43213,6 @@ var ts;
|
|
|
43242
43213
|
switch (extensions) {
|
|
43243
43214
|
case Extensions.JavaScript:
|
|
43244
43215
|
case Extensions.Json:
|
|
43245
|
-
case Extensions.TypeScriptButNotDts:
|
|
43246
43216
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43247
43217
|
break;
|
|
43248
43218
|
case Extensions.TypeScript:
|
|
@@ -43321,8 +43291,6 @@ var ts;
|
|
|
43321
43291
|
return extension === ".json" /* Json */;
|
|
43322
43292
|
case Extensions.TypeScript:
|
|
43323
43293
|
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43324
|
-
case Extensions.TypeScriptButNotDts:
|
|
43325
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */;
|
|
43326
43294
|
case Extensions.DtsOnly:
|
|
43327
43295
|
return extension === ".d.ts" /* Dts */;
|
|
43328
43296
|
}
|
|
@@ -54939,7 +54907,7 @@ var ts;
|
|
|
54939
54907
|
if (!omitTypeAlias) {
|
|
54940
54908
|
return errorType;
|
|
54941
54909
|
}
|
|
54942
|
-
return
|
|
54910
|
+
return getGlobalTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
|
|
54943
54911
|
}
|
|
54944
54912
|
var members = ts.createSymbolTable();
|
|
54945
54913
|
for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
|
|
@@ -55391,7 +55359,7 @@ var ts;
|
|
|
55391
55359
|
}
|
|
55392
55360
|
}
|
|
55393
55361
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55394
|
-
type = getUnionType(sourceTypes);
|
|
55362
|
+
type = getUnionType(sourceTypes, 2 /* Subtype */);
|
|
55395
55363
|
}
|
|
55396
55364
|
}
|
|
55397
55365
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -56706,7 +56674,7 @@ var ts;
|
|
|
56706
56674
|
}
|
|
56707
56675
|
}
|
|
56708
56676
|
if (memberTypeList.length) {
|
|
56709
|
-
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined);
|
|
56677
|
+
var enumType_1 = getUnionType(memberTypeList, 1 /* Literal */, symbol, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined);
|
|
56710
56678
|
if (enumType_1.flags & 1048576 /* Union */) {
|
|
56711
56679
|
enumType_1.flags |= 1024 /* EnumLiteral */;
|
|
56712
56680
|
enumType_1.symbol = symbol;
|
|
@@ -58326,8 +58294,10 @@ var ts;
|
|
|
58326
58294
|
return type;
|
|
58327
58295
|
}
|
|
58328
58296
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
58329
|
-
|
|
58330
|
-
|
|
58297
|
+
var objectType;
|
|
58298
|
+
return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
|
|
58299
|
+
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
58300
|
+
!objectType.declaration.questionToken && !objectType.declaration.nameType);
|
|
58331
58301
|
}
|
|
58332
58302
|
/**
|
|
58333
58303
|
* For a type parameter, return the base constraint of the type parameter. For the string, number,
|
|
@@ -58915,7 +58885,19 @@ var ts;
|
|
|
58915
58885
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
58916
58886
|
});
|
|
58917
58887
|
var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
58918
|
-
|
|
58888
|
+
if (lastParamVariadicType) {
|
|
58889
|
+
// Parameter has effective annotation, lock in type
|
|
58890
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
58891
|
+
}
|
|
58892
|
+
else {
|
|
58893
|
+
// Parameter has no annotation
|
|
58894
|
+
// 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
|
|
58895
|
+
// cached by `getTypeOfSymbol` yet.
|
|
58896
|
+
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
58897
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
58898
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
58899
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
58900
|
+
}
|
|
58919
58901
|
if (lastParamVariadicType) {
|
|
58920
58902
|
// Replace the last parameter with a rest parameter.
|
|
58921
58903
|
parameters.pop();
|
|
@@ -59415,7 +59397,7 @@ var ts;
|
|
|
59415
59397
|
type.resolvedTypeArguments = source.resolvedTypeArguments;
|
|
59416
59398
|
return type;
|
|
59417
59399
|
}
|
|
59418
|
-
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments) {
|
|
59400
|
+
function createDeferredTypeReference(target, node, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
59419
59401
|
if (!aliasSymbol) {
|
|
59420
59402
|
aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59421
59403
|
var localAliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
|
|
@@ -59427,6 +59409,7 @@ var ts;
|
|
|
59427
59409
|
type.mapper = mapper;
|
|
59428
59410
|
type.aliasSymbol = aliasSymbol;
|
|
59429
59411
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
59412
|
+
type.aliasMapper = aliasMapper;
|
|
59430
59413
|
return type;
|
|
59431
59414
|
}
|
|
59432
59415
|
function getTypeArguments(type) {
|
|
@@ -59491,7 +59474,7 @@ var ts;
|
|
|
59491
59474
|
}
|
|
59492
59475
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59493
59476
|
}
|
|
59494
|
-
function
|
|
59477
|
+
function getGlobalTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
59495
59478
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59496
59479
|
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59497
59480
|
return getStringMappingType(symbol, typeArguments[0]);
|
|
@@ -59505,6 +59488,33 @@ var ts;
|
|
|
59505
59488
|
}
|
|
59506
59489
|
return instantiation;
|
|
59507
59490
|
}
|
|
59491
|
+
function getLocalTypeAliasInstantiation(symbol, typeArguments, outerTypeParameterMapper, aliasSymbol, aliasTypeArguments) {
|
|
59492
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
59493
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
59494
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
59495
|
+
}
|
|
59496
|
+
var links = getSymbolLinks(symbol);
|
|
59497
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(symbol);
|
|
59498
|
+
var mappedOuterParams = outerTypeParameterMapper && outerTypeParameters && instantiateTypes(outerTypeParameters, outerTypeParameterMapper);
|
|
59499
|
+
var typeParameters = links.typeParameters;
|
|
59500
|
+
var id = getTypeListId(ts.concatenate(mappedOuterParams, typeArguments)) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59501
|
+
var instantiation = links.instantiations.get(id);
|
|
59502
|
+
if (!instantiation) {
|
|
59503
|
+
var outerTypeArgumentMapper = outerTypeParameters && mappedOuterParams && createTypeMapper(outerTypeParameters, mappedOuterParams);
|
|
59504
|
+
var argumentMapper = createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(symbol.valueDeclaration)));
|
|
59505
|
+
var combinedMapper = outerTypeArgumentMapper ? combineTypeMappers(argumentMapper, outerTypeArgumentMapper) : argumentMapper;
|
|
59506
|
+
links.instantiations.set(id, instantiation = instantiateTypeWithAlias(type, combinedMapper, aliasSymbol, aliasTypeArguments));
|
|
59507
|
+
}
|
|
59508
|
+
return instantiation;
|
|
59509
|
+
}
|
|
59510
|
+
function getOuterTypeParametersOfAlias(symbol) {
|
|
59511
|
+
var _a;
|
|
59512
|
+
var links = getSymbolLinks(symbol);
|
|
59513
|
+
if (!links.outerTypeParameters) {
|
|
59514
|
+
links.outerTypeParameters = ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]) && getOuterTypeParameters(symbol.declarations[0], /*includeThisTypes*/ true);
|
|
59515
|
+
}
|
|
59516
|
+
return links.outerTypeParameters;
|
|
59517
|
+
}
|
|
59508
59518
|
/**
|
|
59509
59519
|
* Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include
|
|
59510
59520
|
* references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the
|
|
@@ -59540,7 +59550,7 @@ var ts;
|
|
|
59540
59550
|
// a .d.ts file. See #43622 for an example.
|
|
59541
59551
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
59542
59552
|
var newAliasSymbol = aliasSymbol && (isLocalTypeAlias(symbol) || !isLocalTypeAlias(aliasSymbol)) ? aliasSymbol : undefined;
|
|
59543
|
-
return
|
|
59553
|
+
return getGlobalTypeAliasInstantiation(symbol, typeArgumentsFromTypeReferenceNode(node), newAliasSymbol, getTypeArgumentsForAliasSymbol(newAliasSymbol));
|
|
59544
59554
|
}
|
|
59545
59555
|
return checkNoTypeArguments(node, symbol) ? type : errorType;
|
|
59546
59556
|
}
|
|
@@ -60455,14 +60465,7 @@ var ts;
|
|
|
60455
60465
|
result.types = types;
|
|
60456
60466
|
return result;
|
|
60457
60467
|
}
|
|
60458
|
-
|
|
60459
|
-
// flag is specified we also reduce the constituent type set to only include types that aren't subtypes
|
|
60460
|
-
// of other types. Subtype reduction is expensive for large union types and is possible only when union
|
|
60461
|
-
// types are known not to circularly reference themselves (as is the case with union types created by
|
|
60462
|
-
// expression constructs such as array literals and the || and ?: operators). Named types can
|
|
60463
|
-
// circularly reference themselves and therefore cannot be subtype reduced during their declaration.
|
|
60464
|
-
// For example, "type Item = string | (() => Item" is a named type that circularly references itself.
|
|
60465
|
-
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) {
|
|
60468
|
+
function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60466
60469
|
if (unionReduction === void 0) { unionReduction = 1 /* Literal */; }
|
|
60467
60470
|
if (types.length === 0) {
|
|
60468
60471
|
return neverType;
|
|
@@ -60531,7 +60534,7 @@ var ts;
|
|
|
60531
60534
|
}
|
|
60532
60535
|
var objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 65536 /* PrimitiveUnion */) |
|
|
60533
60536
|
(includes & 2097152 /* Intersection */ ? 33554432 /* ContainsIntersections */ : 0);
|
|
60534
|
-
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
|
|
60537
|
+
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
60535
60538
|
}
|
|
60536
60539
|
function getUnionOrIntersectionTypePredicate(signatures, kind) {
|
|
60537
60540
|
var first;
|
|
@@ -60569,7 +60572,7 @@ var ts;
|
|
|
60569
60572
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
60570
60573
|
}
|
|
60571
60574
|
// This function assumes the constituent type list is sorted and deduplicated.
|
|
60572
|
-
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
60575
|
+
function getUnionTypeFromSortedList(types, objectFlags, aliasSymbol, aliasTypeArguments, aliasMapper, origin) {
|
|
60573
60576
|
if (types.length === 0) {
|
|
60574
60577
|
return neverType;
|
|
60575
60578
|
}
|
|
@@ -60589,6 +60592,7 @@ var ts;
|
|
|
60589
60592
|
type.origin = origin;
|
|
60590
60593
|
type.aliasSymbol = aliasSymbol;
|
|
60591
60594
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
60595
|
+
type.aliasMapper = aliasMapper;
|
|
60592
60596
|
if (types.length === 2 && types[0].flags & 512 /* BooleanLiteral */ && types[1].flags & 512 /* BooleanLiteral */) {
|
|
60593
60597
|
type.flags |= 16 /* Boolean */;
|
|
60594
60598
|
type.intrinsicName = "boolean";
|
|
@@ -60601,7 +60605,7 @@ var ts;
|
|
|
60601
60605
|
var links = getNodeLinks(node);
|
|
60602
60606
|
if (!links.resolvedType) {
|
|
60603
60607
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60604
|
-
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
60608
|
+
links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), 1 /* Literal */, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
60605
60609
|
}
|
|
60606
60610
|
return links.resolvedType;
|
|
60607
60611
|
}
|
|
@@ -60760,25 +60764,16 @@ var ts;
|
|
|
60760
60764
|
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
|
|
60761
60765
|
return true;
|
|
60762
60766
|
}
|
|
60763
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60767
|
+
function createIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60764
60768
|
var result = createType(2097152 /* Intersection */);
|
|
60765
60769
|
result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
|
|
60766
60770
|
result.types = types;
|
|
60767
60771
|
result.aliasSymbol = aliasSymbol;
|
|
60768
60772
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
60773
|
+
result.aliasMapper = aliasMapper;
|
|
60769
60774
|
return result;
|
|
60770
60775
|
}
|
|
60771
|
-
|
|
60772
|
-
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
|
|
60773
|
-
// types with union type constituents into equivalent union types with intersection type constituents and
|
|
60774
|
-
// effectively ensure that union types are always at the top level in type representations.
|
|
60775
|
-
//
|
|
60776
|
-
// We do not perform structural deduplication on intersection types. Intersection types are created only by the &
|
|
60777
|
-
// type operator and we can't reduce those because we want to support recursive intersection types. For example,
|
|
60778
|
-
// a type alias of the form "type List<T> = T & { next: List<T> }" cannot be reduced during its declaration.
|
|
60779
|
-
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
|
|
60780
|
-
// for intersections of types with signatures can be deterministic.
|
|
60781
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
60776
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
60782
60777
|
var typeMembershipMap = new ts.Map();
|
|
60783
60778
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
60784
60779
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -60838,16 +60833,16 @@ var ts;
|
|
|
60838
60833
|
// When the intersection creates a reduced set (which might mean that *all* union types have
|
|
60839
60834
|
// disappeared), we restart the operation to get a new set of combined flags. Once we have
|
|
60840
60835
|
// reduced we'll never reduce again, so this occurs at most once.
|
|
60841
|
-
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
60836
|
+
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60842
60837
|
}
|
|
60843
60838
|
else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
60844
60839
|
var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
|
|
60845
60840
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
60846
|
-
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60841
|
+
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60847
60842
|
}
|
|
60848
60843
|
else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
60849
60844
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60850
|
-
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60845
|
+
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
60851
60846
|
}
|
|
60852
60847
|
else {
|
|
60853
60848
|
// We are attempting to construct a type of the form X & (A | B) & (C | D). Transform this into a type of
|
|
@@ -60860,7 +60855,7 @@ var ts;
|
|
|
60860
60855
|
// We attach a denormalized origin type when at least one constituent of the cross-product union is an
|
|
60861
60856
|
// intersection (i.e. when the intersection didn't just reduce one or more unions to smaller unions).
|
|
60862
60857
|
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152 /* Intersection */); }) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : undefined;
|
|
60863
|
-
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
60858
|
+
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper, origin);
|
|
60864
60859
|
}
|
|
60865
60860
|
}
|
|
60866
60861
|
else {
|
|
@@ -60906,7 +60901,7 @@ var ts;
|
|
|
60906
60901
|
var links = getNodeLinks(node);
|
|
60907
60902
|
if (!links.resolvedType) {
|
|
60908
60903
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
60909
|
-
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
|
|
60904
|
+
links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), /*aliasMapper*/ undefined);
|
|
60910
60905
|
}
|
|
60911
60906
|
return links.resolvedType;
|
|
60912
60907
|
}
|
|
@@ -61025,7 +61020,7 @@ var ts;
|
|
|
61025
61020
|
var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ?
|
|
61026
61021
|
info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; });
|
|
61027
61022
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
|
|
61028
|
-
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
|
|
61023
|
+
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, origin);
|
|
61029
61024
|
}
|
|
61030
61025
|
/**
|
|
61031
61026
|
* A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
|
|
@@ -61058,7 +61053,7 @@ var ts;
|
|
|
61058
61053
|
return type;
|
|
61059
61054
|
}
|
|
61060
61055
|
var extractTypeAlias = getGlobalExtractSymbol();
|
|
61061
|
-
return extractTypeAlias ?
|
|
61056
|
+
return extractTypeAlias ? getGlobalTypeAliasInstantiation(extractTypeAlias, [type, stringType]) : stringType;
|
|
61062
61057
|
}
|
|
61063
61058
|
function getIndexTypeOrString(type) {
|
|
61064
61059
|
var indexType = getExtractStringType(getIndexType(type));
|
|
@@ -61188,13 +61183,14 @@ var ts;
|
|
|
61188
61183
|
result.type = type;
|
|
61189
61184
|
return result;
|
|
61190
61185
|
}
|
|
61191
|
-
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
61186
|
+
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61192
61187
|
var type = createType(8388608 /* IndexedAccess */);
|
|
61193
61188
|
type.objectType = objectType;
|
|
61194
61189
|
type.indexType = indexType;
|
|
61195
61190
|
type.accessFlags = accessFlags;
|
|
61196
61191
|
type.aliasSymbol = aliasSymbol;
|
|
61197
61192
|
type.aliasTypeArguments = aliasTypeArguments;
|
|
61193
|
+
type.aliasMapper = aliasMapper;
|
|
61198
61194
|
return type;
|
|
61199
61195
|
}
|
|
61200
61196
|
/**
|
|
@@ -61512,7 +61508,7 @@ var ts;
|
|
|
61512
61508
|
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
|
|
61513
61509
|
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
|
|
61514
61510
|
// construct the type Box<T[X]>.
|
|
61515
|
-
if (isGenericMappedType(objectType)) {
|
|
61511
|
+
if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
|
|
61516
61512
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61517
61513
|
}
|
|
61518
61514
|
return type[cache] = type;
|
|
@@ -61552,9 +61548,9 @@ var ts;
|
|
|
61552
61548
|
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
61553
61549
|
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
|
|
61554
61550
|
}
|
|
61555
|
-
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61551
|
+
function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61556
61552
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61557
|
-
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
61553
|
+
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) || (accessNode ? errorType : unknownType);
|
|
61558
61554
|
}
|
|
61559
61555
|
function indexTypeLessThan(indexType, limit) {
|
|
61560
61556
|
return everyType(indexType, function (t) {
|
|
@@ -61568,7 +61564,7 @@ var ts;
|
|
|
61568
61564
|
return false;
|
|
61569
61565
|
});
|
|
61570
61566
|
}
|
|
61571
|
-
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
61567
|
+
function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
61572
61568
|
if (accessFlags === void 0) { accessFlags = 0 /* None */; }
|
|
61573
61569
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
61574
61570
|
return wildcardType;
|
|
@@ -61599,7 +61595,7 @@ var ts;
|
|
|
61599
61595
|
var id = objectType.id + "," + indexType.id + "," + persistentAccessFlags + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
61600
61596
|
var type = indexedAccessTypes.get(id);
|
|
61601
61597
|
if (!type) {
|
|
61602
|
-
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments));
|
|
61598
|
+
indexedAccessTypes.set(id, type = createIndexedAccessType(objectType, indexType, persistentAccessFlags, aliasSymbol, aliasTypeArguments, aliasMapper));
|
|
61603
61599
|
}
|
|
61604
61600
|
return type;
|
|
61605
61601
|
}
|
|
@@ -61629,8 +61625,8 @@ var ts;
|
|
|
61629
61625
|
return undefined;
|
|
61630
61626
|
}
|
|
61631
61627
|
return accessFlags & 4 /* Writing */
|
|
61632
|
-
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments)
|
|
61633
|
-
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
61628
|
+
? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments, aliasMapper)
|
|
61629
|
+
: getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper);
|
|
61634
61630
|
}
|
|
61635
61631
|
return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
|
|
61636
61632
|
}
|
|
@@ -61640,7 +61636,7 @@ var ts;
|
|
|
61640
61636
|
var objectType = getTypeFromTypeNode(node.objectType);
|
|
61641
61637
|
var indexType = getTypeFromTypeNode(node.indexType);
|
|
61642
61638
|
var potentialAlias = getAliasSymbolForTypeNode(node);
|
|
61643
|
-
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias));
|
|
61639
|
+
var resolved = getIndexedAccessType(objectType, indexType, 0 /* None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias), /*aliasMapper*/ undefined);
|
|
61644
61640
|
links.resolvedType = resolved.flags & 8388608 /* IndexedAccess */ &&
|
|
61645
61641
|
resolved.objectType === objectType &&
|
|
61646
61642
|
resolved.indexType === indexType ?
|
|
@@ -61807,6 +61803,7 @@ var ts;
|
|
|
61807
61803
|
result.combinedMapper = combinedMapper;
|
|
61808
61804
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
61809
61805
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
61806
|
+
result.aliasMapper = result.aliasSymbol ? mapper : undefined;
|
|
61810
61807
|
return "break";
|
|
61811
61808
|
};
|
|
61812
61809
|
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
@@ -62602,7 +62599,7 @@ var ts;
|
|
|
62602
62599
|
var result = target.instantiations.get(id);
|
|
62603
62600
|
if (!result) {
|
|
62604
62601
|
var newMapper = createTypeMapper(typeParameters, typeArguments);
|
|
62605
|
-
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62602
|
+
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
62606
62603
|
target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) :
|
|
62607
62604
|
instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
62608
62605
|
target.instantiations.set(id, result);
|
|
@@ -62691,7 +62688,7 @@ var ts;
|
|
|
62691
62688
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
62692
62689
|
}
|
|
62693
62690
|
return t;
|
|
62694
|
-
}, aliasSymbol, aliasTypeArguments);
|
|
62691
|
+
}, aliasSymbol, aliasTypeArguments, mapper);
|
|
62695
62692
|
}
|
|
62696
62693
|
}
|
|
62697
62694
|
// If the constraint type of the instantiation is the wildcard type, return the wildcard type.
|
|
@@ -62760,6 +62757,7 @@ var ts;
|
|
|
62760
62757
|
result.mapper = mapper;
|
|
62761
62758
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62762
62759
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62760
|
+
result.aliasMapper = mapper;
|
|
62763
62761
|
return result;
|
|
62764
62762
|
}
|
|
62765
62763
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -62779,7 +62777,7 @@ var ts;
|
|
|
62779
62777
|
// distributive conditional type T extends U ? X : Y is instantiated with A | B for T, the
|
|
62780
62778
|
// result is (A extends U ? X : Y) | (B extends U ? X : Y).
|
|
62781
62779
|
result = distributionType && checkType_1 !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ?
|
|
62782
|
-
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments) :
|
|
62780
|
+
mapTypeWithAlias(getReducedType(distributionType), function (t) { return getConditionalType(root, prependTypeMapping(checkType_1, t, newMapper_1)); }, aliasSymbol, aliasTypeArguments, mapper) :
|
|
62783
62781
|
getConditionalType(root, newMapper_1, aliasSymbol, aliasTypeArguments);
|
|
62784
62782
|
root.instantiations.set(id, result);
|
|
62785
62783
|
}
|
|
@@ -62839,8 +62837,8 @@ var ts;
|
|
|
62839
62837
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62840
62838
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62841
62839
|
return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ?
|
|
62842
|
-
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) :
|
|
62843
|
-
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
|
|
62840
|
+
getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments, mapper) :
|
|
62841
|
+
getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
62844
62842
|
}
|
|
62845
62843
|
if (flags & 4194304 /* Index */) {
|
|
62846
62844
|
return getIndexType(instantiateType(type.type, mapper));
|
|
@@ -62854,7 +62852,7 @@ var ts;
|
|
|
62854
62852
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
62855
62853
|
var newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
62856
62854
|
var newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
62857
|
-
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
|
|
62855
|
+
return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments, mapper);
|
|
62858
62856
|
}
|
|
62859
62857
|
if (flags & 16777216 /* Conditional */) {
|
|
62860
62858
|
return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
|
|
@@ -63585,7 +63583,7 @@ var ts;
|
|
|
63585
63583
|
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
|
63586
63584
|
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
|
63587
63585
|
: getReturnTypeOfSignature(target);
|
|
63588
|
-
if (targetReturnType === voidType) {
|
|
63586
|
+
if (targetReturnType === voidType || targetReturnType === anyType) {
|
|
63589
63587
|
return result;
|
|
63590
63588
|
}
|
|
63591
63589
|
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
|
@@ -64848,7 +64846,10 @@ var ts;
|
|
|
64848
64846
|
if (variances === ts.emptyArray) {
|
|
64849
64847
|
return 1 /* Unknown */;
|
|
64850
64848
|
}
|
|
64851
|
-
var
|
|
64849
|
+
var outerTypeParameters = getOuterTypeParametersOfAlias(source.aliasSymbol);
|
|
64850
|
+
var sourceArgs = outerTypeParameters && source.aliasMapper ? ts.concatenate(source.aliasTypeArguments, instantiateTypes(outerTypeParameters, source.aliasMapper)) : source.aliasTypeArguments;
|
|
64851
|
+
var targetArgs = outerTypeParameters && target.aliasMapper ? ts.concatenate(target.aliasTypeArguments, instantiateTypes(outerTypeParameters, target.aliasMapper)) : target.aliasTypeArguments;
|
|
64852
|
+
var varianceResult = relateVariances(sourceArgs, targetArgs, variances, intersectionState);
|
|
64852
64853
|
if (varianceResult !== undefined) {
|
|
64853
64854
|
return varianceResult;
|
|
64854
64855
|
}
|
|
@@ -66137,8 +66138,11 @@ var ts;
|
|
|
66137
66138
|
}
|
|
66138
66139
|
function getAliasVariances(symbol) {
|
|
66139
66140
|
var links = getSymbolLinks(symbol);
|
|
66140
|
-
|
|
66141
|
-
|
|
66141
|
+
// outer type parameter aliases are last so they can be easily ignored by, eg, inference
|
|
66142
|
+
var params = ts.concatenate(links.typeParameters, getOuterTypeParametersOfAlias(symbol));
|
|
66143
|
+
return getVariancesWorker(params, links, function (_links, param, marker) {
|
|
66144
|
+
var mapper = makeUnaryTypeMapper(param, marker);
|
|
66145
|
+
var type = getLocalTypeAliasInstantiation(symbol, instantiateTypes(links.typeParameters, mapper), mapper);
|
|
66142
66146
|
type.aliasTypeArgumentsContainsMarker = true;
|
|
66143
66147
|
return type;
|
|
66144
66148
|
});
|
|
@@ -66795,7 +66799,7 @@ var ts;
|
|
|
66795
66799
|
}
|
|
66796
66800
|
// If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
|
|
66797
66801
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
66798
|
-
|
|
66802
|
+
getGlobalTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
66799
66803
|
reducedType;
|
|
66800
66804
|
}
|
|
66801
66805
|
function getNonNullableType(type) {
|
|
@@ -69021,7 +69025,7 @@ var ts;
|
|
|
69021
69025
|
newOrigin = createOriginUnionOrIntersectionType(1048576 /* Union */, originFiltered);
|
|
69022
69026
|
}
|
|
69023
69027
|
}
|
|
69024
|
-
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, newOrigin);
|
|
69028
|
+
return getUnionTypeFromSortedList(filtered, type.objectFlags, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, /*aliasMapper*/ undefined, newOrigin);
|
|
69025
69029
|
}
|
|
69026
69030
|
return type.flags & 131072 /* Never */ || f(type) ? type : neverType;
|
|
69027
69031
|
}
|
|
@@ -69057,9 +69061,9 @@ var ts;
|
|
|
69057
69061
|
}
|
|
69058
69062
|
return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
|
|
69059
69063
|
}
|
|
69060
|
-
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
69064
|
+
function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments, aliasMapper) {
|
|
69061
69065
|
return type.flags & 1048576 /* Union */ && aliasSymbol ?
|
|
69062
|
-
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) :
|
|
69066
|
+
getUnionType(ts.map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments, aliasMapper) :
|
|
69063
69067
|
mapType(type, mapper);
|
|
69064
69068
|
}
|
|
69065
69069
|
function extractTypesOfKind(type, kind) {
|
|
@@ -71874,7 +71878,7 @@ var ts;
|
|
|
71874
71878
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
71875
71879
|
return mapType(type, function (t) {
|
|
71876
71880
|
var _a;
|
|
71877
|
-
if (isGenericMappedType(t)) {
|
|
71881
|
+
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
71878
71882
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
71879
71883
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
71880
71884
|
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
@@ -72244,7 +72248,7 @@ var ts;
|
|
|
72244
72248
|
var params = getSymbolLinks(managedSym).typeParameters;
|
|
72245
72249
|
if (ts.length(params) >= 2) {
|
|
72246
72250
|
var args = fillMissingTypeArguments([ctorType, attributesType], params, 2, ts.isInJSFile(context));
|
|
72247
|
-
return
|
|
72251
|
+
return getGlobalTypeAliasInstantiation(managedSym, args);
|
|
72248
72252
|
}
|
|
72249
72253
|
}
|
|
72250
72254
|
if (ts.length(declaredManagedType.typeParameters) >= 2) {
|
|
@@ -76802,7 +76806,11 @@ var ts;
|
|
|
76802
76806
|
if (signatureHasRestParameter(signature)) {
|
|
76803
76807
|
// parameter might be a transient symbol generated by use of `arguments` in the function body.
|
|
76804
76808
|
var parameter = ts.last(signature.parameters);
|
|
76805
|
-
if (
|
|
76809
|
+
if (parameter.valueDeclaration
|
|
76810
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
76811
|
+
// a declarationless parameter may still have a `.type` already set by its construction logic
|
|
76812
|
+
// (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
|
|
76813
|
+
: !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
|
|
76806
76814
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
76807
76815
|
assignParameterType(parameter, contextualParameterType);
|
|
76808
76816
|
}
|
|
@@ -76821,8 +76829,8 @@ var ts;
|
|
|
76821
76829
|
var links = getSymbolLinks(parameter);
|
|
76822
76830
|
if (!links.type) {
|
|
76823
76831
|
var declaration = parameter.valueDeclaration;
|
|
76824
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
76825
|
-
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
76832
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
|
|
76833
|
+
if (declaration && declaration.name.kind !== 79 /* Identifier */) {
|
|
76826
76834
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
76827
76835
|
if (links.type === unknownType) {
|
|
76828
76836
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
@@ -80384,7 +80392,7 @@ var ts;
|
|
|
80384
80392
|
if (awaitedSymbol) {
|
|
80385
80393
|
// Unwrap unions that may contain `Awaited<T>`, otherwise its possible to manufacture an `Awaited<Awaited<T> | U>` where
|
|
80386
80394
|
// an `Awaited<T | U>` would suffice.
|
|
80387
|
-
return
|
|
80395
|
+
return getGlobalTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
|
|
80388
80396
|
}
|
|
80389
80397
|
}
|
|
80390
80398
|
}
|