@typescript-deploys/pr-build 4.7.0-pr-48094-5 → 4.7.0-pr-48264-4

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 CHANGED
@@ -42,6 +42,7 @@ declare namespace ts.server.protocol {
42
42
  Rename = "rename",
43
43
  Saveto = "saveto",
44
44
  SignatureHelp = "signatureHelp",
45
+ SourceDefinitionAndBoundSpan = "sourceDefinitionAndBoundSpan",
45
46
  Status = "status",
46
47
  TypeDefinition = "typeDefinition",
47
48
  ProjectInfo = "projectInfo",
@@ -661,6 +662,9 @@ declare namespace ts.server.protocol {
661
662
  interface DefinitionAndBoundSpanRequest extends FileLocationRequest {
662
663
  readonly command: CommandTypes.DefinitionAndBoundSpan;
663
664
  }
665
+ interface SourceDefinitionAndBoundSpanRequest extends FileLocationRequest {
666
+ readonly command: CommandTypes.SourceDefinitionAndBoundSpan;
667
+ }
664
668
  interface DefinitionAndBoundSpanResponse extends Response {
665
669
  readonly body: DefinitionInfoAndBoundSpan;
666
670
  }
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-insiders.20220314";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220316";
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
- 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."),
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."),
@@ -11431,6 +11431,10 @@ var ts;
11431
11431
  }
11432
11432
  }
11433
11433
  ts.isAnyImportSyntax = isAnyImportSyntax;
11434
+ function isAnyImportOrBareOrAccessedRequire(node) {
11435
+ return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
11436
+ }
11437
+ ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
11434
11438
  function isLateVisibilityPaintedStatement(node) {
11435
11439
  switch (node.kind) {
11436
11440
  case 265:
@@ -12861,14 +12865,14 @@ var ts;
12861
12865
  }
12862
12866
  ts.isFunctionSymbol = isFunctionSymbol;
12863
12867
  function tryGetModuleSpecifierFromDeclaration(node) {
12864
- var _a, _b, _c;
12868
+ var _a, _b;
12865
12869
  switch (node.kind) {
12866
12870
  case 253:
12867
- return node.initializer.arguments[0].text;
12871
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
12868
12872
  case 265:
12869
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
12873
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
12870
12874
  case 264:
12871
- 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;
12875
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
12872
12876
  default:
12873
12877
  ts.Debug.assertNever(node);
12874
12878
  }
@@ -13343,18 +13347,22 @@ var ts;
13343
13347
  }
13344
13348
  ts.isIdentifierName = isIdentifierName;
13345
13349
  function isAliasSymbolDeclaration(node) {
13346
- return node.kind === 264 ||
13350
+ if (node.kind === 264 ||
13347
13351
  node.kind === 263 ||
13348
13352
  node.kind === 266 && !!node.name ||
13349
13353
  node.kind === 267 ||
13350
13354
  node.kind === 273 ||
13351
13355
  node.kind === 269 ||
13352
13356
  node.kind === 274 ||
13353
- node.kind === 270 && exportAssignmentIsAlias(node) ||
13354
- ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13355
- ts.isPropertyAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableExpression(node.parent.right) ||
13356
- node.kind === 296 ||
13357
- node.kind === 295 && isAliasableExpression(node.initializer);
13357
+ node.kind === 270 && exportAssignmentIsAlias(node)) {
13358
+ return true;
13359
+ }
13360
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) ||
13361
+ ts.isPropertyAccessExpression(node)
13362
+ && ts.isBinaryExpression(node.parent)
13363
+ && node.parent.left === node
13364
+ && node.parent.operatorToken.kind === 63
13365
+ && isAliasableExpression(node.parent.right));
13358
13366
  }
13359
13367
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
13360
13368
  function getAliasDeclarationFromName(node) {
@@ -13365,6 +13373,7 @@ var ts;
13365
13373
  case 274:
13366
13374
  case 270:
13367
13375
  case 264:
13376
+ case 273:
13368
13377
  return node.parent;
13369
13378
  case 160:
13370
13379
  do {
@@ -25342,17 +25351,20 @@ var ts;
25342
25351
  return inContext(32768);
25343
25352
  }
25344
25353
  function parseErrorAtCurrentToken(message, arg0) {
25345
- parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
25354
+ return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
25346
25355
  }
25347
25356
  function parseErrorAtPosition(start, length, message, arg0) {
25348
25357
  var lastError = ts.lastOrUndefined(parseDiagnostics);
25358
+ var result;
25349
25359
  if (!lastError || start !== lastError.start) {
25350
- parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
25360
+ result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
25361
+ parseDiagnostics.push(result);
25351
25362
  }
25352
25363
  parseErrorBeforeNextFinishedNode = true;
25364
+ return result;
25353
25365
  }
25354
25366
  function parseErrorAt(start, end, message, arg0) {
25355
- parseErrorAtPosition(start, end - start, message, arg0);
25367
+ return parseErrorAtPosition(start, end - start, message, arg0);
25356
25368
  }
25357
25369
  function parseErrorAtRange(range, message, arg0) {
25358
25370
  parseErrorAt(range.pos, range.end, message, arg0);
@@ -25568,6 +25580,19 @@ var ts;
25568
25580
  parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
25569
25581
  return false;
25570
25582
  }
25583
+ function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
25584
+ if (token() === closeKind) {
25585
+ nextToken();
25586
+ return;
25587
+ }
25588
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
25589
+ if (!openParsed) {
25590
+ return;
25591
+ }
25592
+ if (lastError) {
25593
+ 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)));
25594
+ }
25595
+ }
25571
25596
  function parseOptional(t) {
25572
25597
  if (token() === t) {
25573
25598
  nextToken();
@@ -26906,7 +26931,7 @@ var ts;
26906
26931
  if (!parseExpected(19)) {
26907
26932
  var lastError = ts.lastOrUndefined(parseDiagnostics);
26908
26933
  if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
26909
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
26934
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
26910
26935
  }
26911
26936
  }
26912
26937
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
@@ -28263,10 +28288,11 @@ var ts;
28263
28288
  }
28264
28289
  function parseArrayLiteralExpression() {
28265
28290
  var pos = getNodePos();
28266
- parseExpected(22);
28291
+ var openBracketPosition = scanner.getTokenPos();
28292
+ var openBracketParsed = parseExpected(22);
28267
28293
  var multiLine = scanner.hasPrecedingLineBreak();
28268
28294
  var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
28269
- parseExpected(23);
28295
+ parseExpectedMatchingBrackets(22, 23, openBracketParsed, openBracketPosition);
28270
28296
  return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
28271
28297
  }
28272
28298
  function parseObjectLiteralElement() {
@@ -28314,15 +28340,10 @@ var ts;
28314
28340
  function parseObjectLiteralExpression() {
28315
28341
  var pos = getNodePos();
28316
28342
  var openBracePosition = scanner.getTokenPos();
28317
- parseExpected(18);
28343
+ var openBraceParsed = parseExpected(18);
28318
28344
  var multiLine = scanner.hasPrecedingLineBreak();
28319
28345
  var properties = parseDelimitedList(12, parseObjectLiteralElement, true);
28320
- if (!parseExpected(19)) {
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
- }
28346
+ parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition);
28326
28347
  return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
28327
28348
  }
28328
28349
  function parseFunctionExpression() {
@@ -28371,15 +28392,11 @@ var ts;
28371
28392
  var pos = getNodePos();
28372
28393
  var hasJSDoc = hasPrecedingJSDocComment();
28373
28394
  var openBracePosition = scanner.getTokenPos();
28374
- if (parseExpected(18, diagnosticMessage) || ignoreMissingOpenBrace) {
28395
+ var openBraceParsed = parseExpected(18, diagnosticMessage);
28396
+ if (openBraceParsed || ignoreMissingOpenBrace) {
28375
28397
  var multiLine = scanner.hasPrecedingLineBreak();
28376
28398
  var statements = parseList(1, parseStatement);
28377
- if (!parseExpected(19)) {
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
- }
28399
+ parseExpectedMatchingBrackets(18, 19, openBraceParsed, openBracePosition);
28383
28400
  var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
28384
28401
  if (token() === 63) {
28385
28402
  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 +28439,10 @@ var ts;
28422
28439
  var pos = getNodePos();
28423
28440
  var hasJSDoc = hasPrecedingJSDocComment();
28424
28441
  parseExpected(99);
28425
- parseExpected(20);
28442
+ var openParenPosition = scanner.getTokenPos();
28443
+ var openParenParsed = parseExpected(20);
28426
28444
  var expression = allowInAnd(parseExpression);
28427
- parseExpected(21);
28445
+ parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28428
28446
  var thenStatement = parseStatement();
28429
28447
  var elseStatement = parseOptional(91) ? parseStatement() : undefined;
28430
28448
  return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
@@ -28435,9 +28453,10 @@ var ts;
28435
28453
  parseExpected(90);
28436
28454
  var statement = parseStatement();
28437
28455
  parseExpected(115);
28438
- parseExpected(20);
28456
+ var openParenPosition = scanner.getTokenPos();
28457
+ var openParenParsed = parseExpected(20);
28439
28458
  var expression = allowInAnd(parseExpression);
28440
- parseExpected(21);
28459
+ parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28441
28460
  parseOptional(26);
28442
28461
  return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc);
28443
28462
  }
@@ -28445,9 +28464,10 @@ var ts;
28445
28464
  var pos = getNodePos();
28446
28465
  var hasJSDoc = hasPrecedingJSDocComment();
28447
28466
  parseExpected(115);
28448
- parseExpected(20);
28467
+ var openParenPosition = scanner.getTokenPos();
28468
+ var openParenParsed = parseExpected(20);
28449
28469
  var expression = allowInAnd(parseExpression);
28450
- parseExpected(21);
28470
+ parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28451
28471
  var statement = parseStatement();
28452
28472
  return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
28453
28473
  }
@@ -28514,9 +28534,10 @@ var ts;
28514
28534
  var pos = getNodePos();
28515
28535
  var hasJSDoc = hasPrecedingJSDocComment();
28516
28536
  parseExpected(116);
28517
- parseExpected(20);
28537
+ var openParenPosition = scanner.getTokenPos();
28538
+ var openParenParsed = parseExpected(20);
28518
28539
  var expression = allowInAnd(parseExpression);
28519
- parseExpected(21);
28540
+ parseExpectedMatchingBrackets(20, 21, openParenParsed, openParenPosition);
28520
28541
  var statement = doInsideOfContext(16777216, parseStatement);
28521
28542
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
28522
28543
  }
@@ -29520,7 +29541,7 @@ var ts;
29520
29541
  if (!parseExpected(19)) {
29521
29542
  var lastError = ts.lastOrUndefined(parseDiagnostics);
29522
29543
  if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
29523
- ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
29544
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
29524
29545
  }
29525
29546
  }
29526
29547
  return finishNode(factory.createAssertClause(elements, multiLine), pos);
@@ -30371,8 +30392,7 @@ var ts;
30371
30392
  hasChildren = true;
30372
30393
  if (child.kind === 342) {
30373
30394
  if (childTypeTag) {
30374
- parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
30375
- var lastError = ts.lastOrUndefined(parseDiagnostics);
30395
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
30376
30396
  if (lastError) {
30377
30397
  ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
30378
30398
  }
@@ -31993,6 +32013,13 @@ var ts;
31993
32013
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
31994
32014
  defaultValueDescription: false,
31995
32015
  },
32016
+ {
32017
+ name: "noDtsResolution",
32018
+ type: "boolean",
32019
+ affectsModuleResolution: true,
32020
+ category: ts.Diagnostics.Modules,
32021
+ defaultValueDescription: false,
32022
+ },
31996
32023
  {
31997
32024
  name: "sourceRoot",
31998
32025
  type: "string",
@@ -34093,6 +34120,7 @@ var ts;
34093
34120
  Extensions[Extensions["Json"] = 2] = "Json";
34094
34121
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
34095
34122
  Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
34123
+ Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
34096
34124
  })(Extensions || (Extensions = {}));
34097
34125
  function resolvedTypeScriptOnly(resolved) {
34098
34126
  if (!resolved) {
@@ -34889,13 +34917,31 @@ var ts;
34889
34917
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
34890
34918
  }
34891
34919
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
34892
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
34920
+ var extensions;
34921
+ if (lookupConfig) {
34922
+ extensions = tsconfigExtensions;
34923
+ }
34924
+ else if (compilerOptions.noDtsResolution) {
34925
+ extensions = [Extensions.TypeScriptButNotDts];
34926
+ if (compilerOptions.allowJs)
34927
+ extensions.push(Extensions.JavaScript);
34928
+ if (compilerOptions.resolveJsonModule)
34929
+ extensions.push(Extensions.Json);
34930
+ }
34931
+ else {
34932
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
34933
+ }
34934
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
34893
34935
  }
34894
34936
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
34895
34937
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
34896
34938
  var _a, _b;
34897
34939
  var traceEnabled = isTraceEnabled(compilerOptions, host);
34898
34940
  var failedLookupLocations = [];
34941
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
34942
+ if (compilerOptions.noDtsResolution) {
34943
+ conditions.pop();
34944
+ }
34899
34945
  var state = {
34900
34946
  compilerOptions: compilerOptions,
34901
34947
  host: host,
@@ -34903,7 +34949,7 @@ var ts;
34903
34949
  failedLookupLocations: failedLookupLocations,
34904
34950
  packageJsonInfoCache: cache,
34905
34951
  features: features,
34906
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
34952
+ conditions: conditions,
34907
34953
  };
34908
34954
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
34909
34955
  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);
@@ -35078,20 +35124,22 @@ var ts;
35078
35124
  default: return tryExtension(".d.ts");
35079
35125
  }
35080
35126
  case Extensions.TypeScript:
35127
+ case Extensions.TypeScriptButNotDts:
35128
+ var useDts = extensions === Extensions.TypeScript;
35081
35129
  switch (originalExtension) {
35082
35130
  case ".mjs":
35083
35131
  case ".mts":
35084
35132
  case ".d.mts":
35085
- return tryExtension(".mts") || tryExtension(".d.mts");
35133
+ return tryExtension(".mts") || (useDts ? tryExtension(".d.mts") : undefined);
35086
35134
  case ".cjs":
35087
35135
  case ".cts":
35088
35136
  case ".d.cts":
35089
- return tryExtension(".cts") || tryExtension(".d.cts");
35137
+ return tryExtension(".cts") || (useDts ? tryExtension(".d.cts") : undefined);
35090
35138
  case ".json":
35091
35139
  candidate += ".json";
35092
- return tryExtension(".d.ts");
35140
+ return useDts ? tryExtension(".d.ts") : undefined;
35093
35141
  default:
35094
- return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
35142
+ return tryExtension(".ts") || tryExtension(".tsx") || (useDts ? tryExtension(".d.ts") : undefined);
35095
35143
  }
35096
35144
  case Extensions.JavaScript:
35097
35145
  switch (originalExtension) {
@@ -35296,6 +35344,7 @@ var ts;
35296
35344
  switch (extensions) {
35297
35345
  case Extensions.JavaScript:
35298
35346
  case Extensions.Json:
35347
+ case Extensions.TypeScriptButNotDts:
35299
35348
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
35300
35349
  break;
35301
35350
  case Extensions.TypeScript:
@@ -35364,6 +35413,8 @@ var ts;
35364
35413
  return extension === ".json";
35365
35414
  case Extensions.TypeScript:
35366
35415
  return extension === ".ts" || extension === ".tsx" || extension === ".d.ts";
35416
+ case Extensions.TypeScriptButNotDts:
35417
+ return extension === ".ts" || extension === ".tsx";
35367
35418
  case Extensions.DtsOnly:
35368
35419
  return extension === ".d.ts";
35369
35420
  }
@@ -45682,7 +45733,7 @@ var ts;
45682
45733
  }
45683
45734
  }
45684
45735
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304); }) ? constructorTypes : types;
45685
- type = getUnionType(sourceTypes, 2);
45736
+ type = getUnionType(sourceTypes);
45686
45737
  }
45687
45738
  }
45688
45739
  var widened = getWidenedType(addOptionality(type, false, definedInMethod && !definedInConstructor));
@@ -48235,8 +48286,10 @@ var ts;
48235
48286
  return type;
48236
48287
  }
48237
48288
  function isMappedTypeGenericIndexedAccess(type) {
48238
- return type.flags & 8388608 && ts.getObjectFlags(type.objectType) & 32 &&
48239
- !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
48289
+ var objectType;
48290
+ return !!(type.flags & 8388608 && ts.getObjectFlags(objectType = type.objectType) & 32 &&
48291
+ !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
48292
+ !objectType.declaration.questionToken && !objectType.declaration.nameType);
48240
48293
  }
48241
48294
  function getApparentType(type) {
48242
48295
  var t = !(type.flags & 465829888) ? type : getBaseConstraintOfType(type) || unknownType;
@@ -48738,7 +48791,15 @@ var ts;
48738
48791
  return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
48739
48792
  });
48740
48793
  var syntheticArgsSymbol = createSymbol(3, "args", 32768);
48741
- syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
48794
+ if (lastParamVariadicType) {
48795
+ syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
48796
+ }
48797
+ else {
48798
+ syntheticArgsSymbol.checkFlags |= 65536;
48799
+ syntheticArgsSymbol.deferralParent = neverType;
48800
+ syntheticArgsSymbol.deferralConstituents = [anyArrayType];
48801
+ syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
48802
+ }
48742
48803
  if (lastParamVariadicType) {
48743
48804
  parameters.pop();
48744
48805
  }
@@ -51068,7 +51129,7 @@ var ts;
51068
51129
  return type[cache] = elementType;
51069
51130
  }
51070
51131
  }
51071
- if (isGenericMappedType(objectType)) {
51132
+ if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
51072
51133
  return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
51073
51134
  }
51074
51135
  return type[cache] = type;
@@ -52905,7 +52966,7 @@ var ts;
52905
52966
  var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
52906
52967
  : target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
52907
52968
  : getReturnTypeOfSignature(target);
52908
- if (targetReturnType === voidType) {
52969
+ if (targetReturnType === voidType || targetReturnType === anyType) {
52909
52970
  return result;
52910
52971
  }
52911
52972
  var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
@@ -56221,27 +56282,17 @@ var ts;
56221
56282
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
56222
56283
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
56223
56284
  }
56224
- function isValidNumberString(s, roundTripOnly) {
56225
- if (s === "")
56226
- return false;
56227
- var n = +s;
56228
- return isFinite(n) && (!roundTripOnly || "" + n === s);
56229
- }
56230
- function isValidBigIntString(s, roundTripOnly) {
56231
- if (s === "")
56232
- return false;
56285
+ function isValidBigIntString(s) {
56233
56286
  var scanner = ts.createScanner(99, false);
56234
56287
  var success = true;
56235
56288
  scanner.setOnError(function () { return success = false; });
56236
56289
  scanner.setText(s + "n");
56237
56290
  var result = scanner.scan();
56238
- var negative = result === 40;
56239
- if (negative) {
56291
+ if (result === 40) {
56240
56292
  result = scanner.scan();
56241
56293
  }
56242
56294
  var flags = scanner.getTokenFlags();
56243
- return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
56244
- && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
56295
+ return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
56245
56296
  }
56246
56297
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
56247
56298
  if (source === target || target.flags & (1 | 4)) {
@@ -56249,8 +56300,8 @@ var ts;
56249
56300
  }
56250
56301
  if (source.flags & 128) {
56251
56302
  var value = source.value;
56252
- return !!(target.flags & 8 && isValidNumberString(value, false) ||
56253
- target.flags & 64 && isValidBigIntString(value, false) ||
56303
+ return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
56304
+ target.flags & 64 && value !== "" && isValidBigIntString(value) ||
56254
56305
  target.flags & (512 | 98304) && value === target.intrinsicName);
56255
56306
  }
56256
56307
  if (source.flags & 134217728) {
@@ -56716,61 +56767,7 @@ var ts;
56716
56767
  var types = target.types;
56717
56768
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
56718
56769
  for (var i = 0; i < types.length; i++) {
56719
- var source_1 = matches ? matches[i] : neverType;
56720
- var target_3 = types[i];
56721
- var sourceTypes = void 0;
56722
- if (source_1.flags & 128 && target_3.flags & 8650752) {
56723
- var inferenceContext = getInferenceInfoForType(target_3);
56724
- var constraint = inferenceContext ? getConstraintOfTypeParameter(inferenceContext.typeParameter) : undefined;
56725
- if (inferenceContext && constraint) {
56726
- var str = source_1.value;
56727
- var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint];
56728
- for (var _i = 0, constraintTypes_1 = constraintTypes; _i < constraintTypes_1.length; _i++) {
56729
- var constraintType = constraintTypes_1[_i];
56730
- if (constraintType.flags & 402653316) {
56731
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56732
- sourceTypes.push(source_1);
56733
- }
56734
- if (constraintType.flags & 296 && isValidNumberString(str, true)) {
56735
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56736
- sourceTypes.push(getNumberLiteralType(+str));
56737
- }
56738
- if (constraintType.flags & 2112 && isValidBigIntString(str, true)) {
56739
- var negative = str.startsWith("-");
56740
- var base10Value = ts.parsePseudoBigInt((negative ? str.slice(1) : str) + "n");
56741
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56742
- sourceTypes.push(getBigIntLiteralType({ negative: negative, base10Value: base10Value }));
56743
- }
56744
- if (constraintType.flags & 528) {
56745
- if (str === trueType.intrinsicName) {
56746
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56747
- sourceTypes.push(trueType);
56748
- }
56749
- else if (str === falseType.intrinsicName) {
56750
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56751
- sourceTypes.push(falseType);
56752
- }
56753
- }
56754
- if (constraintType.flags & 65536 && str === nullType.intrinsicName) {
56755
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56756
- sourceTypes.push(nullType);
56757
- }
56758
- if (constraintType.flags & 32768 && str === undefinedType.intrinsicName) {
56759
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
56760
- sourceTypes.push(undefinedType);
56761
- }
56762
- }
56763
- }
56764
- }
56765
- if (sourceTypes) {
56766
- for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) {
56767
- var source_2 = sourceTypes_3[_a];
56768
- inferFromTypes(source_2, target_3);
56769
- }
56770
- }
56771
- else {
56772
- inferFromTypes(source_1, target_3);
56773
- }
56770
+ inferFromTypes(matches ? matches[i] : neverType, types[i]);
56774
56771
  }
56775
56772
  }
56776
56773
  }
@@ -60056,7 +60053,7 @@ var ts;
60056
60053
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
60057
60054
  return mapType(type, function (t) {
60058
60055
  var _a;
60059
- if (isGenericMappedType(t)) {
60056
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
60060
60057
  var constraint = getConstraintTypeFromMappedType(t);
60061
60058
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
60062
60059
  var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
@@ -64298,7 +64295,9 @@ var ts;
64298
64295
  }
64299
64296
  if (signatureHasRestParameter(signature)) {
64300
64297
  var parameter = ts.last(signature.parameters);
64301
- if (ts.isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
64298
+ if (parameter.valueDeclaration
64299
+ ? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
64300
+ : !!(ts.getCheckFlags(parameter) & 65536)) {
64302
64301
  var contextualParameterType = getRestTypeAtPosition(context, len);
64303
64302
  assignParameterType(parameter, contextualParameterType);
64304
64303
  }
@@ -64317,8 +64316,8 @@ var ts;
64317
64316
  var links = getSymbolLinks(parameter);
64318
64317
  if (!links.type) {
64319
64318
  var declaration = parameter.valueDeclaration;
64320
- links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, true);
64321
- if (declaration.name.kind !== 79) {
64319
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, true) : getTypeOfSymbol(parameter));
64320
+ if (declaration && declaration.name.kind !== 79) {
64322
64321
  if (links.type === unknownType) {
64323
64322
  links.type = getTypeFromBindingPattern(declaration.name);
64324
64323
  }