typescript 4.7.0-dev.20220315 → 4.7.0-dev.20220318
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/tsc.js +94 -56
- package/lib/tsserver.js +256 -78
- package/lib/tsserverlibrary.js +256 -78
- package/lib/typescript.js +235 -76
- package/lib/typescriptServices.js +235 -76
- package/lib/typingsInstaller.js +100 -57
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220318";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5221,7 +5221,7 @@ var ts;
|
|
|
5221
5221
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
5222
5222
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
5223
5223
|
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."),
|
|
5224
|
-
|
|
5224
|
+
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."),
|
|
5225
5225
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
5226
5226
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
5227
5227
|
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."),
|
|
@@ -5437,6 +5437,7 @@ var ts;
|
|
|
5437
5437
|
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
5438
5438
|
Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
|
|
5439
5439
|
Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
|
|
5440
|
+
A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),
|
|
5440
5441
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5441
5442
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5442
5443
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -25342,17 +25343,20 @@ var ts;
|
|
|
25342
25343
|
return inContext(32768);
|
|
25343
25344
|
}
|
|
25344
25345
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
25345
|
-
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
25346
|
+
return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
25346
25347
|
}
|
|
25347
25348
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
25348
25349
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
25350
|
+
var result;
|
|
25349
25351
|
if (!lastError || start !== lastError.start) {
|
|
25350
|
-
|
|
25352
|
+
result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
|
|
25353
|
+
parseDiagnostics.push(result);
|
|
25351
25354
|
}
|
|
25352
25355
|
parseErrorBeforeNextFinishedNode = true;
|
|
25356
|
+
return result;
|
|
25353
25357
|
}
|
|
25354
25358
|
function parseErrorAt(start, end, message, arg0) {
|
|
25355
|
-
parseErrorAtPosition(start, end - start, message, arg0);
|
|
25359
|
+
return parseErrorAtPosition(start, end - start, message, arg0);
|
|
25356
25360
|
}
|
|
25357
25361
|
function parseErrorAtRange(range, message, arg0) {
|
|
25358
25362
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -25568,6 +25572,19 @@ var ts;
|
|
|
25568
25572
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
25569
25573
|
return false;
|
|
25570
25574
|
}
|
|
25575
|
+
function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
|
|
25576
|
+
if (token() === closeKind) {
|
|
25577
|
+
nextToken();
|
|
25578
|
+
return;
|
|
25579
|
+
}
|
|
25580
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
25581
|
+
if (!openParsed) {
|
|
25582
|
+
return;
|
|
25583
|
+
}
|
|
25584
|
+
if (lastError) {
|
|
25585
|
+
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)));
|
|
25586
|
+
}
|
|
25587
|
+
}
|
|
25571
25588
|
function parseOptional(t) {
|
|
25572
25589
|
if (token() === t) {
|
|
25573
25590
|
nextToken();
|
|
@@ -26906,7 +26923,7 @@ var ts;
|
|
|
26906
26923
|
if (!parseExpected(19)) {
|
|
26907
26924
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
26908
26925
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
26909
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
26926
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
26910
26927
|
}
|
|
26911
26928
|
}
|
|
26912
26929
|
return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
@@ -28263,10 +28280,11 @@ var ts;
|
|
|
28263
28280
|
}
|
|
28264
28281
|
function parseArrayLiteralExpression() {
|
|
28265
28282
|
var pos = getNodePos();
|
|
28266
|
-
|
|
28283
|
+
var openBracketPosition = scanner.getTokenPos();
|
|
28284
|
+
var openBracketParsed = parseExpected(22);
|
|
28267
28285
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
28268
28286
|
var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
|
|
28269
|
-
|
|
28287
|
+
parseExpectedMatchingBrackets(22, 23, openBracketParsed, openBracketPosition);
|
|
28270
28288
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
28271
28289
|
}
|
|
28272
28290
|
function parseObjectLiteralElement() {
|
|
@@ -28314,15 +28332,10 @@ var ts;
|
|
|
28314
28332
|
function parseObjectLiteralExpression() {
|
|
28315
28333
|
var pos = getNodePos();
|
|
28316
28334
|
var openBracePosition = scanner.getTokenPos();
|
|
28317
|
-
parseExpected(18);
|
|
28335
|
+
var openBraceParsed = parseExpected(18);
|
|
28318
28336
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
28319
28337
|
var properties = parseDelimitedList(12, parseObjectLiteralElement, true);
|
|
28320
|
-
|
|
28321
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
28322
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
28323
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
28324
|
-
}
|
|
28325
|
-
}
|
|
28338
|
+
parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition);
|
|
28326
28339
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
28327
28340
|
}
|
|
28328
28341
|
function parseFunctionExpression() {
|
|
@@ -28371,15 +28384,11 @@ var ts;
|
|
|
28371
28384
|
var pos = getNodePos();
|
|
28372
28385
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28373
28386
|
var openBracePosition = scanner.getTokenPos();
|
|
28374
|
-
|
|
28387
|
+
var openBraceParsed = parseExpected(18, diagnosticMessage);
|
|
28388
|
+
if (openBraceParsed || ignoreMissingOpenBrace) {
|
|
28375
28389
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
28376
28390
|
var statements = parseList(1, parseStatement);
|
|
28377
|
-
|
|
28378
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
28379
|
-
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
28380
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
28381
|
-
}
|
|
28382
|
-
}
|
|
28391
|
+
parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition);
|
|
28383
28392
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
28384
28393
|
if (token() === 63) {
|
|
28385
28394
|
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);
|
|
@@ -28422,9 +28431,10 @@ var ts;
|
|
|
28422
28431
|
var pos = getNodePos();
|
|
28423
28432
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28424
28433
|
parseExpected(99);
|
|
28425
|
-
|
|
28434
|
+
var openParenPosition = scanner.getTokenPos();
|
|
28435
|
+
var openParenParsed = parseExpected(20);
|
|
28426
28436
|
var expression = allowInAnd(parseExpression);
|
|
28427
|
-
|
|
28437
|
+
parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
|
|
28428
28438
|
var thenStatement = parseStatement();
|
|
28429
28439
|
var elseStatement = parseOptional(91) ? parseStatement() : undefined;
|
|
28430
28440
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -28435,9 +28445,10 @@ var ts;
|
|
|
28435
28445
|
parseExpected(90);
|
|
28436
28446
|
var statement = parseStatement();
|
|
28437
28447
|
parseExpected(115);
|
|
28438
|
-
|
|
28448
|
+
var openParenPosition = scanner.getTokenPos();
|
|
28449
|
+
var openParenParsed = parseExpected(20);
|
|
28439
28450
|
var expression = allowInAnd(parseExpression);
|
|
28440
|
-
|
|
28451
|
+
parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
|
|
28441
28452
|
parseOptional(26);
|
|
28442
28453
|
return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc);
|
|
28443
28454
|
}
|
|
@@ -28445,9 +28456,10 @@ var ts;
|
|
|
28445
28456
|
var pos = getNodePos();
|
|
28446
28457
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28447
28458
|
parseExpected(115);
|
|
28448
|
-
|
|
28459
|
+
var openParenPosition = scanner.getTokenPos();
|
|
28460
|
+
var openParenParsed = parseExpected(20);
|
|
28449
28461
|
var expression = allowInAnd(parseExpression);
|
|
28450
|
-
|
|
28462
|
+
parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
|
|
28451
28463
|
var statement = parseStatement();
|
|
28452
28464
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
28453
28465
|
}
|
|
@@ -28514,9 +28526,10 @@ var ts;
|
|
|
28514
28526
|
var pos = getNodePos();
|
|
28515
28527
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28516
28528
|
parseExpected(116);
|
|
28517
|
-
|
|
28529
|
+
var openParenPosition = scanner.getTokenPos();
|
|
28530
|
+
var openParenParsed = parseExpected(20);
|
|
28518
28531
|
var expression = allowInAnd(parseExpression);
|
|
28519
|
-
|
|
28532
|
+
parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
|
|
28520
28533
|
var statement = doInsideOfContext(16777216, parseStatement);
|
|
28521
28534
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
28522
28535
|
}
|
|
@@ -29520,7 +29533,7 @@ var ts;
|
|
|
29520
29533
|
if (!parseExpected(19)) {
|
|
29521
29534
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
29522
29535
|
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
29523
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.
|
|
29536
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
|
|
29524
29537
|
}
|
|
29525
29538
|
}
|
|
29526
29539
|
return finishNode(factory.createAssertClause(elements, multiLine), pos);
|
|
@@ -30371,8 +30384,7 @@ var ts;
|
|
|
30371
30384
|
hasChildren = true;
|
|
30372
30385
|
if (child.kind === 342) {
|
|
30373
30386
|
if (childTypeTag) {
|
|
30374
|
-
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
30375
|
-
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
30387
|
+
var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
30376
30388
|
if (lastError) {
|
|
30377
30389
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
30378
30390
|
}
|
|
@@ -33307,7 +33319,10 @@ var ts;
|
|
|
33307
33319
|
}
|
|
33308
33320
|
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
|
|
33309
33321
|
function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
|
|
33310
|
-
|
|
33322
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse", "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
|
|
33323
|
+
var result = parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
|
|
33324
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
33325
|
+
return result;
|
|
33311
33326
|
}
|
|
33312
33327
|
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
|
|
33313
33328
|
function setConfigFileInOptions(options, configFile) {
|
|
@@ -48235,8 +48250,10 @@ var ts;
|
|
|
48235
48250
|
return type;
|
|
48236
48251
|
}
|
|
48237
48252
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
48238
|
-
|
|
48239
|
-
|
|
48253
|
+
var objectType;
|
|
48254
|
+
return !!(type.flags & 8388608 && ts.getObjectFlags(objectType = type.objectType) & 32 &&
|
|
48255
|
+
!isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
|
|
48256
|
+
!objectType.declaration.questionToken && !objectType.declaration.nameType);
|
|
48240
48257
|
}
|
|
48241
48258
|
function getApparentType(type) {
|
|
48242
48259
|
var t = !(type.flags & 465829888) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
@@ -48738,7 +48755,15 @@ var ts;
|
|
|
48738
48755
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
48739
48756
|
});
|
|
48740
48757
|
var syntheticArgsSymbol = createSymbol(3, "args", 32768);
|
|
48741
|
-
|
|
48758
|
+
if (lastParamVariadicType) {
|
|
48759
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
48760
|
+
}
|
|
48761
|
+
else {
|
|
48762
|
+
syntheticArgsSymbol.checkFlags |= 65536;
|
|
48763
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
48764
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
48765
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
48766
|
+
}
|
|
48742
48767
|
if (lastParamVariadicType) {
|
|
48743
48768
|
parameters.pop();
|
|
48744
48769
|
}
|
|
@@ -51068,7 +51093,7 @@ var ts;
|
|
|
51068
51093
|
return type[cache] = elementType;
|
|
51069
51094
|
}
|
|
51070
51095
|
}
|
|
51071
|
-
if (isGenericMappedType(objectType)) {
|
|
51096
|
+
if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
|
|
51072
51097
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
51073
51098
|
}
|
|
51074
51099
|
return type[cache] = type;
|
|
@@ -52905,7 +52930,7 @@ var ts;
|
|
|
52905
52930
|
var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
|
|
52906
52931
|
: target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
|
|
52907
52932
|
: getReturnTypeOfSignature(target);
|
|
52908
|
-
if (targetReturnType === voidType) {
|
|
52933
|
+
if (targetReturnType === voidType || targetReturnType === anyType) {
|
|
52909
52934
|
return result;
|
|
52910
52935
|
}
|
|
52911
52936
|
var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
|
|
@@ -59992,7 +60017,7 @@ var ts;
|
|
|
59992
60017
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
59993
60018
|
return mapType(type, function (t) {
|
|
59994
60019
|
var _a;
|
|
59995
|
-
if (isGenericMappedType(t)) {
|
|
60020
|
+
if (isGenericMappedType(t) && !t.declaration.nameType) {
|
|
59996
60021
|
var constraint = getConstraintTypeFromMappedType(t);
|
|
59997
60022
|
var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
59998
60023
|
var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
|
|
@@ -64234,7 +64259,9 @@ var ts;
|
|
|
64234
64259
|
}
|
|
64235
64260
|
if (signatureHasRestParameter(signature)) {
|
|
64236
64261
|
var parameter = ts.last(signature.parameters);
|
|
64237
|
-
if (
|
|
64262
|
+
if (parameter.valueDeclaration
|
|
64263
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
64264
|
+
: !!(ts.getCheckFlags(parameter) & 65536)) {
|
|
64238
64265
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
64239
64266
|
assignParameterType(parameter, contextualParameterType);
|
|
64240
64267
|
}
|
|
@@ -64253,8 +64280,8 @@ var ts;
|
|
|
64253
64280
|
var links = getSymbolLinks(parameter);
|
|
64254
64281
|
if (!links.type) {
|
|
64255
64282
|
var declaration = parameter.valueDeclaration;
|
|
64256
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
|
64257
|
-
if (declaration.name.kind !== 79) {
|
|
64283
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, true) : getTypeOfSymbol(parameter));
|
|
64284
|
+
if (declaration && declaration.name.kind !== 79) {
|
|
64258
64285
|
if (links.type === unknownType) {
|
|
64259
64286
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
64260
64287
|
}
|
|
@@ -67514,26 +67541,37 @@ var ts;
|
|
|
67514
67541
|
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
|
|
67515
67542
|
}
|
|
67516
67543
|
function markTypeNodeAsReferenced(node) {
|
|
67517
|
-
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
67544
|
+
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), false);
|
|
67518
67545
|
}
|
|
67519
|
-
function markEntityNameOrEntityExpressionAsReference(typeName) {
|
|
67546
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
67520
67547
|
if (!typeName)
|
|
67521
67548
|
return;
|
|
67522
67549
|
var rootName = ts.getFirstIdentifier(typeName);
|
|
67523
67550
|
var meaning = (typeName.kind === 79 ? 788968 : 1920) | 2097152;
|
|
67524
67551
|
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
|
|
67525
|
-
if (rootSymbol
|
|
67526
|
-
|
|
67527
|
-
|
|
67528
|
-
|
|
67529
|
-
|
|
67530
|
-
|
|
67552
|
+
if (rootSymbol && rootSymbol.flags & 2097152) {
|
|
67553
|
+
if (symbolIsValue(rootSymbol)
|
|
67554
|
+
&& !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
|
|
67555
|
+
&& !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
67556
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
67557
|
+
}
|
|
67558
|
+
else if (forDecoratorMetadata
|
|
67559
|
+
&& compilerOptions.isolatedModules
|
|
67560
|
+
&& ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
|
|
67561
|
+
&& !symbolIsValue(rootSymbol)
|
|
67562
|
+
&& !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
|
|
67563
|
+
var diag = error(typeName, ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
67564
|
+
var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
|
|
67565
|
+
if (aliasDeclaration) {
|
|
67566
|
+
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
|
|
67567
|
+
}
|
|
67568
|
+
}
|
|
67531
67569
|
}
|
|
67532
67570
|
}
|
|
67533
67571
|
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
67534
67572
|
var entityName = getEntityNameForDecoratorMetadata(node);
|
|
67535
67573
|
if (entityName && ts.isEntityName(entityName)) {
|
|
67536
|
-
markEntityNameOrEntityExpressionAsReference(entityName);
|
|
67574
|
+
markEntityNameOrEntityExpressionAsReference(entityName, true);
|
|
67537
67575
|
}
|
|
67538
67576
|
}
|
|
67539
67577
|
function getEntityNameForDecoratorMetadata(node) {
|
|
@@ -70644,7 +70682,7 @@ var ts;
|
|
|
70644
70682
|
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
70645
70683
|
return;
|
|
70646
70684
|
}
|
|
70647
|
-
if (!checkGrammarDecoratorsAndModifiers(node) && ts.
|
|
70685
|
+
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
|
|
70648
70686
|
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
|
|
70649
70687
|
}
|
|
70650
70688
|
if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0) {
|
|
@@ -73533,9 +73571,9 @@ var ts;
|
|
|
73533
73571
|
}
|
|
73534
73572
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
73535
73573
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
73536
|
-
|
|
73537
|
-
if (
|
|
73538
|
-
parent =
|
|
73574
|
+
var host_2 = ts.getJSDocHost(parent);
|
|
73575
|
+
if (host_2) {
|
|
73576
|
+
parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
|
|
73539
73577
|
}
|
|
73540
73578
|
}
|
|
73541
73579
|
switch (parent.kind) {
|