@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.
@@ -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.20220314";
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
- 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."),
@@ -14939,6 +14939,10 @@ 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;
14942
14946
  function isLateVisibilityPaintedStatement(node) {
14943
14947
  switch (node.kind) {
14944
14948
  case 265 /* ImportDeclaration */:
@@ -16517,14 +16521,14 @@ var ts;
16517
16521
  }
16518
16522
  ts.isFunctionSymbol = isFunctionSymbol;
16519
16523
  function tryGetModuleSpecifierFromDeclaration(node) {
16520
- var _a, _b, _c;
16524
+ var _a, _b;
16521
16525
  switch (node.kind) {
16522
16526
  case 253 /* VariableDeclaration */:
16523
- return node.initializer.arguments[0].text;
16527
+ return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
16524
16528
  case 265 /* ImportDeclaration */:
16525
- return (_a = ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike)) === null || _a === void 0 ? void 0 : _a.text;
16529
+ return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
16526
16530
  case 264 /* ImportEqualsDeclaration */:
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;
16531
+ return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
16528
16532
  default:
16529
16533
  ts.Debug.assertNever(node);
16530
16534
  }
@@ -17051,21 +17055,28 @@ var ts;
17051
17055
  // export = <EntityNameExpression>
17052
17056
  // export default <EntityNameExpression>
17053
17057
  // module.exports = <EntityNameExpression>
17054
- // {<Identifier>}
17055
- // {name: <EntityNameExpression>}
17058
+ // module.exports.x = <EntityNameExpression>
17059
+ // const x = require("...")
17060
+ // const { x } = require("...")
17061
+ // const x = require("...").y
17062
+ // const { x } = require("...").y
17056
17063
  function isAliasSymbolDeclaration(node) {
17057
- return node.kind === 264 /* ImportEqualsDeclaration */ ||
17064
+ if (node.kind === 264 /* ImportEqualsDeclaration */ ||
17058
17065
  node.kind === 263 /* NamespaceExportDeclaration */ ||
17059
17066
  node.kind === 266 /* ImportClause */ && !!node.name ||
17060
17067
  node.kind === 267 /* NamespaceImport */ ||
17061
17068
  node.kind === 273 /* NamespaceExport */ ||
17062
17069
  node.kind === 269 /* ImportSpecifier */ ||
17063
17070
  node.kind === 274 /* ExportSpecifier */ ||
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);
17071
+ node.kind === 270 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
17072
+ return true;
17073
+ }
17074
+ return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
17075
+ ts.isPropertyAccessExpression(node)
17076
+ && ts.isBinaryExpression(node.parent)
17077
+ && node.parent.left === node
17078
+ && node.parent.operatorToken.kind === 63 /* EqualsToken */
17079
+ && isAliasableExpression(node.parent.right));
17069
17080
  }
17070
17081
  ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
17071
17082
  function getAliasDeclarationFromName(node) {
@@ -17076,6 +17087,7 @@ var ts;
17076
17087
  case 274 /* ExportSpecifier */:
17077
17088
  case 270 /* ExportAssignment */:
17078
17089
  case 264 /* ImportEqualsDeclaration */:
17090
+ case 273 /* NamespaceExport */:
17079
17091
  return node.parent;
17080
17092
  case 160 /* QualifiedName */:
17081
17093
  do {
@@ -31415,20 +31427,23 @@ var ts;
31415
31427
  return inContext(32768 /* AwaitContext */);
31416
31428
  }
31417
31429
  function parseErrorAtCurrentToken(message, arg0) {
31418
- parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
31430
+ return parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
31419
31431
  }
31420
31432
  function parseErrorAtPosition(start, length, message, arg0) {
31421
31433
  // Don't report another error if it would just be at the same position as the last error.
31422
31434
  var lastError = ts.lastOrUndefined(parseDiagnostics);
31435
+ var result;
31423
31436
  if (!lastError || start !== lastError.start) {
31424
- parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
31437
+ result = ts.createDetachedDiagnostic(fileName, start, length, message, arg0);
31438
+ parseDiagnostics.push(result);
31425
31439
  }
31426
31440
  // Mark that we've encountered an error. We'll set an appropriate bit on the next
31427
31441
  // node we finish so that it can't be reused incrementally.
31428
31442
  parseErrorBeforeNextFinishedNode = true;
31443
+ return result;
31429
31444
  }
31430
31445
  function parseErrorAt(start, end, message, arg0) {
31431
- parseErrorAtPosition(start, end - start, message, arg0);
31446
+ return parseErrorAtPosition(start, end - start, message, arg0);
31432
31447
  }
31433
31448
  function parseErrorAtRange(range, message, arg0) {
31434
31449
  parseErrorAt(range.pos, range.end, message, arg0);
@@ -31701,6 +31716,19 @@ var ts;
31701
31716
  parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
31702
31717
  return false;
31703
31718
  }
31719
+ function parseExpectedMatchingBrackets(openKind, closeKind, openParsed, openPosition) {
31720
+ if (token() === closeKind) {
31721
+ nextToken();
31722
+ return;
31723
+ }
31724
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
31725
+ if (!openParsed) {
31726
+ return;
31727
+ }
31728
+ if (lastError) {
31729
+ 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)));
31730
+ }
31731
+ }
31704
31732
  function parseOptional(t) {
31705
31733
  if (token() === t) {
31706
31734
  nextToken();
@@ -33349,7 +33377,7 @@ var ts;
33349
33377
  if (!parseExpected(19 /* CloseBraceToken */)) {
33350
33378
  var lastError = ts.lastOrUndefined(parseDiagnostics);
33351
33379
  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));
33380
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
33353
33381
  }
33354
33382
  }
33355
33383
  return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos);
@@ -35159,10 +35187,11 @@ var ts;
35159
35187
  }
35160
35188
  function parseArrayLiteralExpression() {
35161
35189
  var pos = getNodePos();
35162
- parseExpected(22 /* OpenBracketToken */);
35190
+ var openBracketPosition = scanner.getTokenPos();
35191
+ var openBracketParsed = parseExpected(22 /* OpenBracketToken */);
35163
35192
  var multiLine = scanner.hasPrecedingLineBreak();
35164
35193
  var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
35165
- parseExpected(23 /* CloseBracketToken */);
35194
+ parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition);
35166
35195
  return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
35167
35196
  }
35168
35197
  function parseObjectLiteralElement() {
@@ -35219,15 +35248,10 @@ var ts;
35219
35248
  function parseObjectLiteralExpression() {
35220
35249
  var pos = getNodePos();
35221
35250
  var openBracePosition = scanner.getTokenPos();
35222
- parseExpected(18 /* OpenBraceToken */);
35251
+ var openBraceParsed = parseExpected(18 /* OpenBraceToken */);
35223
35252
  var multiLine = scanner.hasPrecedingLineBreak();
35224
35253
  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
- }
35254
+ parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
35231
35255
  return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
35232
35256
  }
35233
35257
  function parseFunctionExpression() {
@@ -35283,15 +35307,11 @@ var ts;
35283
35307
  var pos = getNodePos();
35284
35308
  var hasJSDoc = hasPrecedingJSDocComment();
35285
35309
  var openBracePosition = scanner.getTokenPos();
35286
- if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
35310
+ var openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage);
35311
+ if (openBraceParsed || ignoreMissingOpenBrace) {
35287
35312
  var multiLine = scanner.hasPrecedingLineBreak();
35288
35313
  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
- }
35314
+ parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition);
35295
35315
  var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
35296
35316
  if (token() === 63 /* EqualsToken */) {
35297
35317
  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 +35356,10 @@ var ts;
35336
35356
  var pos = getNodePos();
35337
35357
  var hasJSDoc = hasPrecedingJSDocComment();
35338
35358
  parseExpected(99 /* IfKeyword */);
35339
- parseExpected(20 /* OpenParenToken */);
35359
+ var openParenPosition = scanner.getTokenPos();
35360
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35340
35361
  var expression = allowInAnd(parseExpression);
35341
- parseExpected(21 /* CloseParenToken */);
35362
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35342
35363
  var thenStatement = parseStatement();
35343
35364
  var elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : undefined;
35344
35365
  return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
@@ -35349,9 +35370,10 @@ var ts;
35349
35370
  parseExpected(90 /* DoKeyword */);
35350
35371
  var statement = parseStatement();
35351
35372
  parseExpected(115 /* WhileKeyword */);
35352
- parseExpected(20 /* OpenParenToken */);
35373
+ var openParenPosition = scanner.getTokenPos();
35374
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35353
35375
  var expression = allowInAnd(parseExpression);
35354
- parseExpected(21 /* CloseParenToken */);
35376
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35355
35377
  // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
35356
35378
  // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
35357
35379
  // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
@@ -35363,9 +35385,10 @@ var ts;
35363
35385
  var pos = getNodePos();
35364
35386
  var hasJSDoc = hasPrecedingJSDocComment();
35365
35387
  parseExpected(115 /* WhileKeyword */);
35366
- parseExpected(20 /* OpenParenToken */);
35388
+ var openParenPosition = scanner.getTokenPos();
35389
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35367
35390
  var expression = allowInAnd(parseExpression);
35368
- parseExpected(21 /* CloseParenToken */);
35391
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35369
35392
  var statement = parseStatement();
35370
35393
  return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
35371
35394
  }
@@ -35432,9 +35455,10 @@ var ts;
35432
35455
  var pos = getNodePos();
35433
35456
  var hasJSDoc = hasPrecedingJSDocComment();
35434
35457
  parseExpected(116 /* WithKeyword */);
35435
- parseExpected(20 /* OpenParenToken */);
35458
+ var openParenPosition = scanner.getTokenPos();
35459
+ var openParenParsed = parseExpected(20 /* OpenParenToken */);
35436
35460
  var expression = allowInAnd(parseExpression);
35437
- parseExpected(21 /* CloseParenToken */);
35461
+ parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition);
35438
35462
  var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
35439
35463
  return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
35440
35464
  }
@@ -36568,7 +36592,7 @@ var ts;
36568
36592
  if (!parseExpected(19 /* CloseBraceToken */)) {
36569
36593
  var lastError = ts.lastOrUndefined(parseDiagnostics);
36570
36594
  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));
36595
+ ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"));
36572
36596
  }
36573
36597
  }
36574
36598
  return finishNode(factory.createAssertClause(elements, multiLine), pos);
@@ -37544,8 +37568,7 @@ var ts;
37544
37568
  hasChildren = true;
37545
37569
  if (child.kind === 342 /* JSDocTypeTag */) {
37546
37570
  if (childTypeTag) {
37547
- parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
37548
- var lastError = ts.lastOrUndefined(parseDiagnostics);
37571
+ var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
37549
37572
  if (lastError) {
37550
37573
  ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
37551
37574
  }
@@ -39423,6 +39446,13 @@ var ts;
39423
39446
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39424
39447
  defaultValueDescription: false,
39425
39448
  },
39449
+ {
39450
+ name: "noDtsResolution",
39451
+ type: "boolean",
39452
+ affectsModuleResolution: true,
39453
+ category: ts.Diagnostics.Modules,
39454
+ defaultValueDescription: false,
39455
+ },
39426
39456
  // Source Maps
39427
39457
  {
39428
39458
  name: "sourceRoot",
@@ -41802,7 +41832,8 @@ var ts;
41802
41832
  Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
41803
41833
  Extensions[Extensions["Json"] = 2] = "Json";
41804
41834
  Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
41805
- Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly"; /** Only '.d.ts' */
41835
+ Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
41836
+ Extensions[Extensions["TypeScriptButNotDts"] = 5] = "TypeScriptButNotDts";
41806
41837
  })(Extensions || (Extensions = {}));
41807
41838
  /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
41808
41839
  function resolvedTypeScriptOnly(resolved) {
@@ -42747,7 +42778,21 @@ var ts;
42747
42778
  return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
42748
42779
  }
42749
42780
  function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
42750
- return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
42781
+ var extensions;
42782
+ if (lookupConfig) {
42783
+ extensions = tsconfigExtensions;
42784
+ }
42785
+ else if (compilerOptions.noDtsResolution) {
42786
+ extensions = [Extensions.TypeScriptButNotDts];
42787
+ if (compilerOptions.allowJs)
42788
+ extensions.push(Extensions.JavaScript);
42789
+ if (compilerOptions.resolveJsonModule)
42790
+ extensions.push(Extensions.Json);
42791
+ }
42792
+ else {
42793
+ extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
42794
+ }
42795
+ return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
42751
42796
  }
42752
42797
  ts.nodeModuleNameResolver = nodeModuleNameResolver;
42753
42798
  function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
@@ -42756,6 +42801,10 @@ var ts;
42756
42801
  var failedLookupLocations = [];
42757
42802
  // conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
42758
42803
  //it's essentially a set (priority is determined by object insertion order in the object we look at).
42804
+ var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
42805
+ if (compilerOptions.noDtsResolution) {
42806
+ conditions.pop();
42807
+ }
42759
42808
  var state = {
42760
42809
  compilerOptions: compilerOptions,
42761
42810
  host: host,
@@ -42763,7 +42812,7 @@ var ts;
42763
42812
  failedLookupLocations: failedLookupLocations,
42764
42813
  packageJsonInfoCache: cache,
42765
42814
  features: features,
42766
- conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
42815
+ conditions: conditions,
42767
42816
  };
42768
42817
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
42769
42818
  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);
@@ -42971,20 +43020,22 @@ var ts;
42971
43020
  default: return tryExtension(".d.ts" /* Dts */);
42972
43021
  }
42973
43022
  case Extensions.TypeScript:
43023
+ case Extensions.TypeScriptButNotDts:
43024
+ var useDts = extensions === Extensions.TypeScript;
42974
43025
  switch (originalExtension) {
42975
43026
  case ".mjs" /* Mjs */:
42976
43027
  case ".mts" /* Mts */:
42977
43028
  case ".d.mts" /* Dmts */:
42978
- return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
43029
+ return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
42979
43030
  case ".cjs" /* Cjs */:
42980
43031
  case ".cts" /* Cts */:
42981
43032
  case ".d.cts" /* Dcts */:
42982
- return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
43033
+ return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
42983
43034
  case ".json" /* Json */:
42984
43035
  candidate += ".json" /* Json */;
42985
- return tryExtension(".d.ts" /* Dts */);
43036
+ return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
42986
43037
  default:
42987
- return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
43038
+ return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
42988
43039
  }
42989
43040
  case Extensions.JavaScript:
42990
43041
  switch (originalExtension) {
@@ -43202,6 +43253,7 @@ var ts;
43202
43253
  switch (extensions) {
43203
43254
  case Extensions.JavaScript:
43204
43255
  case Extensions.Json:
43256
+ case Extensions.TypeScriptButNotDts:
43205
43257
  packageFile = readPackageJsonMainField(jsonContent, candidate, state);
43206
43258
  break;
43207
43259
  case Extensions.TypeScript:
@@ -43280,6 +43332,8 @@ var ts;
43280
43332
  return extension === ".json" /* Json */;
43281
43333
  case Extensions.TypeScript:
43282
43334
  return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
43335
+ case Extensions.TypeScriptButNotDts:
43336
+ return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */;
43283
43337
  case Extensions.DtsOnly:
43284
43338
  return extension === ".d.ts" /* Dts */;
43285
43339
  }
@@ -55348,7 +55402,7 @@ var ts;
55348
55402
  }
55349
55403
  }
55350
55404
  var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
55351
- type = getUnionType(sourceTypes, 2 /* Subtype */);
55405
+ type = getUnionType(sourceTypes);
55352
55406
  }
55353
55407
  }
55354
55408
  var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
@@ -58283,8 +58337,10 @@ var ts;
58283
58337
  return type;
58284
58338
  }
58285
58339
  function isMappedTypeGenericIndexedAccess(type) {
58286
- return type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(type.objectType) & 32 /* Mapped */ &&
58287
- !isGenericMappedType(type.objectType) && isGenericIndexType(type.indexType);
58340
+ var objectType;
58341
+ return !!(type.flags & 8388608 /* IndexedAccess */ && ts.getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ &&
58342
+ !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) &&
58343
+ !objectType.declaration.questionToken && !objectType.declaration.nameType);
58288
58344
  }
58289
58345
  /**
58290
58346
  * For a type parameter, return the base constraint of the type parameter. For the string, number,
@@ -58872,7 +58928,19 @@ var ts;
58872
58928
  return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
58873
58929
  });
58874
58930
  var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
58875
- syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
58931
+ if (lastParamVariadicType) {
58932
+ // Parameter has effective annotation, lock in type
58933
+ syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
58934
+ }
58935
+ else {
58936
+ // Parameter has no annotation
58937
+ // 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
58938
+ // cached by `getTypeOfSymbol` yet.
58939
+ syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
58940
+ syntheticArgsSymbol.deferralParent = neverType;
58941
+ syntheticArgsSymbol.deferralConstituents = [anyArrayType];
58942
+ syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
58943
+ }
58876
58944
  if (lastParamVariadicType) {
58877
58945
  // Replace the last parameter with a rest parameter.
58878
58946
  parameters.pop();
@@ -61469,7 +61537,7 @@ var ts;
61469
61537
  // If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
61470
61538
  // that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
61471
61539
  // construct the type Box<T[X]>.
61472
- if (isGenericMappedType(objectType)) {
61540
+ if (isGenericMappedType(objectType) && !objectType.declaration.nameType) {
61473
61541
  return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
61474
61542
  }
61475
61543
  return type[cache] = type;
@@ -63542,7 +63610,7 @@ var ts;
63542
63610
  var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType
63543
63611
  : target.declaration && isJSConstructor(target.declaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(target.declaration.symbol))
63544
63612
  : getReturnTypeOfSignature(target);
63545
- if (targetReturnType === voidType) {
63613
+ if (targetReturnType === voidType || targetReturnType === anyType) {
63546
63614
  return result;
63547
63615
  }
63548
63616
  var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType
@@ -67401,32 +67469,13 @@ var ts;
67401
67469
  return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
67402
67470
  sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
67403
67471
  }
67404
- /**
67405
- * Tests whether the provided string can be parsed as a number.
67406
- * @param s The string to test.
67407
- * @param roundTripOnly Indicates the resulting number matches the input when converted back to a string.
67408
- */
67409
- function isValidNumberString(s, roundTripOnly) {
67410
- if (s === "")
67411
- return false;
67412
- var n = +s;
67413
- return isFinite(n) && (!roundTripOnly || "" + n === s);
67414
- }
67415
- /**
67416
- * Tests whether the provided string can be parsed as a bigint.
67417
- * @param s The string to test.
67418
- * @param roundTripOnly Indicates the resulting bigint matches the input when converted back to a string.
67419
- */
67420
- function isValidBigIntString(s, roundTripOnly) {
67421
- if (s === "")
67422
- return false;
67472
+ function isValidBigIntString(s) {
67423
67473
  var scanner = ts.createScanner(99 /* ESNext */, /*skipTrivia*/ false);
67424
67474
  var success = true;
67425
67475
  scanner.setOnError(function () { return success = false; });
67426
67476
  scanner.setText(s + "n");
67427
67477
  var result = scanner.scan();
67428
- var negative = result === 40 /* MinusToken */;
67429
- if (negative) {
67478
+ if (result === 40 /* MinusToken */) {
67430
67479
  result = scanner.scan();
67431
67480
  }
67432
67481
  var flags = scanner.getTokenFlags();
@@ -67435,8 +67484,7 @@ var ts;
67435
67484
  // * a bigint can be scanned, and that when it is scanned, it is
67436
67485
  // * the full length of the input string (so the scanner is one character beyond the augmented input length)
67437
67486
  // * it does not contain a numeric seperator (the `BigInt` constructor does not accept a numeric seperator in its input)
67438
- return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */)
67439
- && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
67487
+ return success && result === 9 /* BigIntLiteral */ && scanner.getTextPos() === (s.length + 1) && !(flags & 512 /* ContainsSeparator */);
67440
67488
  }
67441
67489
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
67442
67490
  if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
@@ -67444,8 +67492,8 @@ var ts;
67444
67492
  }
67445
67493
  if (source.flags & 128 /* StringLiteral */) {
67446
67494
  var value = source.value;
67447
- return !!(target.flags & 8 /* Number */ && isValidNumberString(value, /*roundTripOnly*/ false) ||
67448
- target.flags & 64 /* BigInt */ && isValidBigIntString(value, /*roundTripOnly*/ false) ||
67495
+ return !!(target.flags & 8 /* Number */ && value !== "" && isFinite(+value) ||
67496
+ target.flags & 64 /* BigInt */ && value !== "" && isValidBigIntString(value) ||
67449
67497
  target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName);
67450
67498
  }
67451
67499
  if (source.flags & 134217728 /* TemplateLiteral */) {
@@ -68019,63 +68067,7 @@ var ts;
68019
68067
  // succeed. That would be a pointless and confusing outcome.
68020
68068
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
68021
68069
  for (var i = 0; i < types.length; i++) {
68022
- var source_1 = matches ? matches[i] : neverType;
68023
- var target_3 = types[i];
68024
- // If we are inferring from a string literal type to a type variable whose constraint includes one of the
68025
- // allowed template literal placeholder types, infer from a literal type corresponding to the constraint.
68026
- var sourceTypes = void 0;
68027
- if (source_1.flags & 128 /* StringLiteral */ && target_3.flags & 8650752 /* TypeVariable */) {
68028
- var inferenceContext = getInferenceInfoForType(target_3);
68029
- var constraint = inferenceContext ? getConstraintOfTypeParameter(inferenceContext.typeParameter) : undefined;
68030
- if (inferenceContext && constraint) {
68031
- var str = source_1.value;
68032
- var constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint];
68033
- for (var _i = 0, constraintTypes_1 = constraintTypes; _i < constraintTypes_1.length; _i++) {
68034
- var constraintType = constraintTypes_1[_i];
68035
- if (constraintType.flags & 402653316 /* StringLike */) {
68036
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68037
- sourceTypes.push(source_1);
68038
- }
68039
- if (constraintType.flags & 296 /* NumberLike */ && isValidNumberString(str, /*roundTripOnly*/ true)) {
68040
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68041
- sourceTypes.push(getNumberLiteralType(+str));
68042
- }
68043
- if (constraintType.flags & 2112 /* BigIntLike */ && isValidBigIntString(str, /*roundTripOnly*/ true)) {
68044
- var negative = str.startsWith("-");
68045
- var base10Value = ts.parsePseudoBigInt((negative ? str.slice(1) : str) + "n");
68046
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68047
- sourceTypes.push(getBigIntLiteralType({ negative: negative, base10Value: base10Value }));
68048
- }
68049
- if (constraintType.flags & 528 /* BooleanLike */) {
68050
- if (str === trueType.intrinsicName) {
68051
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68052
- sourceTypes.push(trueType);
68053
- }
68054
- else if (str === falseType.intrinsicName) {
68055
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68056
- sourceTypes.push(falseType);
68057
- }
68058
- }
68059
- if (constraintType.flags & 65536 /* Null */ && str === nullType.intrinsicName) {
68060
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68061
- sourceTypes.push(nullType);
68062
- }
68063
- if (constraintType.flags & 32768 /* Undefined */ && str === undefinedType.intrinsicName) {
68064
- sourceTypes !== null && sourceTypes !== void 0 ? sourceTypes : (sourceTypes = []);
68065
- sourceTypes.push(undefinedType);
68066
- }
68067
- }
68068
- }
68069
- }
68070
- if (sourceTypes) {
68071
- for (var _a = 0, sourceTypes_3 = sourceTypes; _a < sourceTypes_3.length; _a++) {
68072
- var source_2 = sourceTypes_3[_a];
68073
- inferFromTypes(source_2, target_3);
68074
- }
68075
- }
68076
- else {
68077
- inferFromTypes(source_1, target_3);
68078
- }
68070
+ inferFromTypes(matches ? matches[i] : neverType, types[i]);
68079
68071
  }
68080
68072
  }
68081
68073
  }
@@ -71907,7 +71899,7 @@ var ts;
71907
71899
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
71908
71900
  return mapType(type, function (t) {
71909
71901
  var _a;
71910
- if (isGenericMappedType(t)) {
71902
+ if (isGenericMappedType(t) && !t.declaration.nameType) {
71911
71903
  var constraint = getConstraintTypeFromMappedType(t);
71912
71904
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
71913
71905
  var propertyNameType = nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name));
@@ -76835,7 +76827,11 @@ var ts;
76835
76827
  if (signatureHasRestParameter(signature)) {
76836
76828
  // parameter might be a transient symbol generated by use of `arguments` in the function body.
76837
76829
  var parameter = ts.last(signature.parameters);
76838
- if (ts.isTransientSymbol(parameter) || !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) {
76830
+ if (parameter.valueDeclaration
76831
+ ? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
76832
+ // a declarationless parameter may still have a `.type` already set by its construction logic
76833
+ // (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
76834
+ : !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
76839
76835
  var contextualParameterType = getRestTypeAtPosition(context, len);
76840
76836
  assignParameterType(parameter, contextualParameterType);
76841
76837
  }
@@ -76854,8 +76850,8 @@ var ts;
76854
76850
  var links = getSymbolLinks(parameter);
76855
76851
  if (!links.type) {
76856
76852
  var declaration = parameter.valueDeclaration;
76857
- links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
76858
- if (declaration.name.kind !== 79 /* Identifier */) {
76853
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
76854
+ if (declaration && declaration.name.kind !== 79 /* Identifier */) {
76859
76855
  // if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
76860
76856
  if (links.type === unknownType) {
76861
76857
  links.type = getTypeFromBindingPattern(declaration.name);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.7.0-pr-48094-5",
5
+ "version": "4.7.0-pr-48264-4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [