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.
@@ -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-dev.20220315";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220318";
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
- The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."),
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."),
@@ -8239,6 +8239,7 @@ var ts;
8239
8239
  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."),
8240
8240
  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}'."),
8241
8241
  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'."),
8242
+ 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."),
8242
8243
  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."),
8243
8244
  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."),
8244
8245
  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."),
@@ -31415,20 +31416,23 @@ var ts;
31415
31416
  return inContext(32768 /* AwaitContext */);
31416
31417
  }
31417
31418
  function parseErrorAtCurrentToken(message, arg0) {
31418
- parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
31419
+ return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
31419
31420
  }
31420
31421
  function parseErrorAtPosition(start, length, message, arg0) {
31421
31422
  // Don't report another error if it would just be at the same position as the last error.
31422
31423
  var lastError = ts.lastOrUndefined(parseDiagnostics);
31424
+ var result;
31423
31425
  if (!lastError || start !== lastError.start) {
31424
- parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
31426
+ result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
31427
+ parseDiagnostics.push(result);
31425
31428
  }
31426
31429
  // Mark that we've encountered an error. We'll set an appropriate bit on the next
31427
31430
  // node we finish so that it can't be reused incrementally.
31428
31431
  parseErrorBeforeNextFinishedNode = true;
31432
+ return result;
31429
31433
  }
31430
31434
  function parseErrorAt(start, end, message, arg0) {
31431
- parseErrorAtPosition(start, end - start, message, arg0);
31435
+ return parseErrorAtPosition(start, end - start, message, arg0);
31432
31436
  }
31433
31437
  function parseErrorAtRange(range, message, arg0) {
31434
31438
  parseErrorAt(range.pos, range.end, message, arg0);
@@ -31701,6 +31705,19 @@ var ts;
31701
31705
  parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
31702
31706
  return false;
31703
31707
  }
31708
+ function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
31709
+ if (token() === closeKind) {
31710
+ nextToken();
31711
+ return;
31712
+ }
31713
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
31714
+ if (!openParsed) {
31715
+ return;
31716
+ }
31717
+ if (lastError) {
31718
+ 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)));
31719
+ }
31720
+ }
31704
31721
  function parseOptional(t) {
31705
31722
  if (token() === t) {
31706
31723
  nextToken();
@@ -33349,7 +33366,7 @@ var ts;
33349
33366
  if (!parseExpected(19 /* CloseBraceToken */)) {
33350
33367
  var lastError = ts.lastOrUndefined(parseDiagnostics);
33351
33368
  if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
33352
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
33369
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
33353
33370
  }
33354
33371
  }
33355
33372
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
@@ -35159,10 +35176,11 @@ var ts;
35159
35176
  }
35160
35177
  function parseArrayLiteralExpression() {
35161
35178
  var pos = getNodePos();
35162
- parseExpected(22 /* OpenBracketToken */);
35179
+ var openBracketPosition = scanner.getTokenPos();
35180
+ var openBracketParsed = parseExpected(22 /* OpenBracketToken */);
35163
35181
  var multiLine = scanner.hasPrecedingLineBreak();
35164
35182
  var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
35165
- parseExpected(23 /* CloseBracketToken */);
35183
+ parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
35166
35184
  return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
35167
35185
  }
35168
35186
  function parseObjectLiteralElement() {
@@ -35219,15 +35237,10 @@ var ts;
35219
35237
  function parseObjectLiteralExpression() {
35220
35238
  var pos = getNodePos();
35221
35239
  var openBracePosition = scanner.getTokenPos();
35222
- parseExpected(18 /* OpenBraceToken */);
35240
+ var openBraceParsed = parseExpected(18 /* OpenBraceToken */);
35223
35241
  var multiLine = scanner.hasPrecedingLineBreak();
35224
35242
  var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
35225
- if (!parseExpected(19 /* CloseBraceToken */)) {
35226
- var lastError = ts.lastOrUndefined(parseDiagnostics);
35227
- if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
35228
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
35229
- }
35230
- }
35243
+ parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
35231
35244
  return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
35232
35245
  }
35233
35246
  function parseFunctionExpression() {
@@ -35283,15 +35296,11 @@ var ts;
35283
35296
  var pos = getNodePos();
35284
35297
  var hasJSDoc = hasPrecedingJSDocComment();
35285
35298
  var openBracePosition = scanner.getTokenPos();
35286
- if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
35299
+ var openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
35300
+ if (openBraceParsed || ignoreMissingOpenBrace) {
35287
35301
  var multiLine = scanner.hasPrecedingLineBreak();
35288
35302
  var statements = parseList(1 /* BlockStatements */, parseStatement);
35289
- if (!parseExpected(19 /* CloseBraceToken */)) {
35290
- var lastError = ts.lastOrUndefined(parseDiagnostics);
35291
- if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
35292
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
35293
- }
35294
- }
35303
+ parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
35295
35304
  var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
35296
35305
  if (token() === 63 /* EqualsToken */) {
35297
35306
  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);
@@ -35336,9 +35345,10 @@ var ts;
35336
35345
  var pos = getNodePos();
35337
35346
  var hasJSDoc = hasPrecedingJSDocComment();
35338
35347
  parseExpected(99 /* IfKeyword */);
35339
- parseExpected(20 /* OpenParenToken */);
35348
+ var openParenPosition = scanner.getTokenPos();
35349
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35340
35350
  var expression = allowInAnd(parseExpression);
35341
- parseExpected(21 /* CloseParenToken */);
35351
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35342
35352
  var thenStatement = parseStatement();
35343
35353
  var elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : undefined;
35344
35354
  return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
@@ -35349,9 +35359,10 @@ var ts;
35349
35359
  parseExpected(90 /* DoKeyword */);
35350
35360
  var statement = parseStatement();
35351
35361
  parseExpected(115 /* WhileKeyword */);
35352
- parseExpected(20 /* OpenParenToken */);
35362
+ var openParenPosition = scanner.getTokenPos();
35363
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35353
35364
  var expression = allowInAnd(parseExpression);
35354
- parseExpected(21 /* CloseParenToken */);
35365
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35355
35366
  // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
35356
35367
  // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
35357
35368
  // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
@@ -35363,9 +35374,10 @@ var ts;
35363
35374
  var pos = getNodePos();
35364
35375
  var hasJSDoc = hasPrecedingJSDocComment();
35365
35376
  parseExpected(115 /* WhileKeyword */);
35366
- parseExpected(20 /* OpenParenToken */);
35377
+ var openParenPosition = scanner.getTokenPos();
35378
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35367
35379
  var expression = allowInAnd(parseExpression);
35368
- parseExpected(21 /* CloseParenToken */);
35380
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35369
35381
  var statement = parseStatement();
35370
35382
  return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
35371
35383
  }
@@ -35432,9 +35444,10 @@ var ts;
35432
35444
  var pos = getNodePos();
35433
35445
  var hasJSDoc = hasPrecedingJSDocComment();
35434
35446
  parseExpected(116 /* WithKeyword */);
35435
- parseExpected(20 /* OpenParenToken */);
35447
+ var openParenPosition = scanner.getTokenPos();
35448
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35436
35449
  var expression = allowInAnd(parseExpression);
35437
- parseExpected(21 /* CloseParenToken */);
35450
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35438
35451
  var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
35439
35452
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
35440
35453
  }
@@ -36568,7 +36581,7 @@ var ts;
36568
36581
  if (!parseExpected(19 /* CloseBraceToken */)) {
36569
36582
  var lastError = ts.lastOrUndefined(parseDiagnostics);
36570
36583
  if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
36571
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
36584
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
36572
36585
  }
36573
36586
  }
36574
36587
  return finishNode(factory.createAssertClause(elements, multiLine), pos);
@@ -37544,8 +37557,7 @@ var ts;
37544
37557
  hasChildren = true;
37545
37558
  if (child.kind === 342 /* JSDocTypeTag */) {
37546
37559
  if (childTypeTag) {
37547
- parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
37548
- var lastError = ts.lastOrUndefined(parseDiagnostics);
37560
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
37549
37561
  if (lastError) {
37550
37562
  ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
37551
37563
  }
@@ -40873,7 +40885,10 @@ var ts;
40873
40885
  * file to. e.g. outDir
40874
40886
  */
40875
40887
  function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
40876
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
40888
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
40889
+ var result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
40890
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
40891
+ return result;
40877
40892
  }
40878
40893
  ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
40879
40894
  /*@internal*/
@@ -58283,8 +58298,10 @@ var ts;
58283
58298
  return type;
58284
58299
  }
58285
58300
  function isMappedTypeGenericIndexedAccess(type) {
58286
- return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
58287
- !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
58301
+ var objectType;
58302
+ return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
58303
+ !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
58304
+ !objectType.declaration.questionToken && !objectType.declaration.nameType);
58288
58305
  }
58289
58306
  /**
58290
58307
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -58872,7 +58889,19 @@ var ts;
58872
58889
  return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
58873
58890
  });
58874
58891
  var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
58875
- syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
58892
+ if (lastParamVariadicType) {
58893
+ // Parameter has effective annotation, lock in type
58894
+ syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
58895
+ }
58896
+ else {
58897
+ // Parameter has no annotation
58898
+ // 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
58899
+ // cached by `getTypeOfSymbol` yet.
58900
+ syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
58901
+ syntheticArgsSymbol.deferralParent = neverType;
58902
+ syntheticArgsSymbol.deferralConstituents = [anyArrayType];
58903
+ syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
58904
+ }
58876
58905
  if (lastParamVariadicType) {
58877
58906
  // Replace the last parameter with a rest parameter.
58878
58907
  parameters.pop();
@@ -61469,7 +61498,7 @@ var ts;
61469
61498
  // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
61470
61499
  // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
61471
61500
  // construct the type Box<T[X]>.
61472
- if (isGenericMappedType(objectType)) {
61501
+ if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
61473
61502
  return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61474
61503
  }
61475
61504
  return type[cache] = type;
@@ -63542,7 +63571,7 @@ var ts;
63542
63571
  var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
63543
63572
  : target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
63544
63573
  : getReturnTypeOfSignature(target);
63545
- if (targetReturnType === voidType) {
63574
+ if (targetReturnType === voidType || targetReturnType === anyType) {
63546
63575
  return result;
63547
63576
  }
63548
63577
  var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
@@ -71831,7 +71860,7 @@ var ts;
71831
71860
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
71832
71861
  return mapType(type, function (t) {
71833
71862
  var _a;
71834
- if (isGenericMappedType(t)) {
71863
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
71835
71864
  var constraint = getConstraintTypeFromMappedType(t);
71836
71865
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
71837
71866
  var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
@@ -76759,7 +76788,11 @@ var ts;
76759
76788
  if (signatureHasRestParameter(signature)) {
76760
76789
  // parameter might be a transient symbol generated by use of `arguments` in the function body.
76761
76790
  var parameter = ts.last(signature.parameters);
76762
- if (ts.isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
76791
+ if (parameter.valueDeclaration
76792
+ ? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
76793
+ // a declarationless parameter may still have a `.type` already set by its construction logic
76794
+ // (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
76795
+ : !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
76763
76796
  var contextualParameterType = getRestTypeAtPosition(context, len);
76764
76797
  assignParameterType(parameter, contextualParameterType);
76765
76798
  }
@@ -76778,8 +76811,8 @@ var ts;
76778
76811
  var links = getSymbolLinks(parameter);
76779
76812
  if (!links.type) {
76780
76813
  var declaration = parameter.valueDeclaration;
76781
- links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
76782
- if (declaration.name.kind !== 79 /* Identifier */) {
76814
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
76815
+ if (declaration && declaration.name.kind !== 79 /* Identifier */) {
76783
76816
  // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
76784
76817
  if (links.type === unknownType) {
76785
76818
  links.type = getTypeFromBindingPattern(declaration.name);
@@ -80592,20 +80625,31 @@ var ts;
80592
80625
  * marked as referenced to prevent import elision.
80593
80626
  */
80594
80627
  function markTypeNodeAsReferenced(node) {
80595
- markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
80628
+ markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), /*forDecoratorMetadata*/ false);
80596
80629
  }
80597
- function markEntityNameOrEntityExpressionAsReference(typeName) {
80630
+ function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
80598
80631
  if (!typeName)
80599
80632
  return;
80600
80633
  var rootName = ts.getFirstIdentifier(typeName);
80601
80634
  var meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
80602
80635
  var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isReference*/ true);
80603
- if (rootSymbol
80604
- && rootSymbol.flags & 2097152 /* Alias */
80605
- && symbolIsValue(rootSymbol)
80606
- && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80607
- && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80608
- markAliasSymbolAsReferenced(rootSymbol);
80636
+ if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
80637
+ if (symbolIsValue(rootSymbol)
80638
+ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
80639
+ && !getTypeOnlyAliasDeclaration(rootSymbol)) {
80640
+ markAliasSymbolAsReferenced(rootSymbol);
80641
+ }
80642
+ else if (forDecoratorMetadata
80643
+ && compilerOptions.isolatedModules
80644
+ && ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
80645
+ && !symbolIsValue(rootSymbol)
80646
+ && !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
80647
+ 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);
80648
+ var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
80649
+ if (aliasDeclaration) {
80650
+ ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
80651
+ }
80652
+ }
80609
80653
  }
80610
80654
  }
80611
80655
  /**
@@ -80618,7 +80662,7 @@ var ts;
80618
80662
  function markDecoratorMedataDataTypeNodeAsReferenced(node) {
80619
80663
  var entityName = getEntityNameForDecoratorMetadata(node);
80620
80664
  if (entityName && ts.isEntityName(entityName)) {
80621
- markEntityNameOrEntityExpressionAsReference(entityName);
80665
+ markEntityNameOrEntityExpressionAsReference(entityName, /*forDecoratorMetadata*/ true);
80622
80666
  }
80623
80667
  }
80624
80668
  function getEntityNameForDecoratorMetadata(node) {
@@ -84270,7 +84314,7 @@ var ts;
84270
84314
  // If we hit an export in an illegal context, just bail out to avoid cascading errors.
84271
84315
  return;
84272
84316
  }
84273
- if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasEffectiveModifiers(node)) {
84317
+ if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
84274
84318
  grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
84275
84319
  }
84276
84320
  if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
@@ -87447,10 +87491,9 @@ var ts;
87447
87491
  }
87448
87492
  var parent = ts.walkUpParenthesizedTypes(node.parent);
87449
87493
  if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
87450
- parent = parent.parent;
87451
- if (ts.isJSDocTypeTag(parent)) {
87452
- // walk up past JSDoc comment node
87453
- parent = parent.parent.parent;
87494
+ var host_2 = ts.getJSDocHost(parent);
87495
+ if (host_2) {
87496
+ parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
87454
87497
  }
87455
87498
  }
87456
87499
  switch (parent.kind) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.7.0-dev.20220315",
5
+ "version": "4.7.0-dev.20220318",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [