@typescript-deploys/pr-build 5.3.0-pr-55842-7 → 5.3.0-pr-55991-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20231001`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231005`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -14270,6 +14270,7 @@ function getPropertyNameForPropertyNameNode(name) {
14270
14270
  case 81 /* PrivateIdentifier */:
14271
14271
  return name.escapedText;
14272
14272
  case 11 /* StringLiteral */:
14273
+ case 15 /* NoSubstitutionTemplateLiteral */:
14273
14274
  case 9 /* NumericLiteral */:
14274
14275
  return escapeLeadingUnderscores(name.text);
14275
14276
  case 167 /* ComputedPropertyName */:
@@ -42360,10 +42361,12 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
42360
42361
  importingSourceFile,
42361
42362
  host,
42362
42363
  userPreferences,
42363
- options
42364
+ options,
42365
+ /*forAutoImport*/
42366
+ false
42364
42367
  ).moduleSpecifiers;
42365
42368
  }
42366
- function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
42369
+ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
42367
42370
  let computedWithoutCache = false;
42368
42371
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
42369
42372
  if (ambient)
@@ -42381,11 +42384,19 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42381
42384
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
42382
42385
  computedWithoutCache = true;
42383
42386
  modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
42384
- const result = computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options);
42387
+ const result = computeModuleSpecifiers(
42388
+ modulePaths,
42389
+ compilerOptions,
42390
+ importingSourceFile,
42391
+ host,
42392
+ userPreferences,
42393
+ options,
42394
+ forAutoImport
42395
+ );
42385
42396
  cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
42386
42397
  return { moduleSpecifiers: result, computedWithoutCache };
42387
42398
  }
42388
- function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
42399
+ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
42389
42400
  const info = getInfo(importingSourceFile.path, host);
42390
42401
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
42391
42402
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
@@ -42442,7 +42453,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42442
42453
  redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
42443
42454
  } else if (pathIsBareSpecifier(local)) {
42444
42455
  pathsSpecifiers = append(pathsSpecifiers, local);
42445
- } else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
42456
+ } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
42446
42457
  relativeSpecifiers = append(relativeSpecifiers, local);
42447
42458
  }
42448
42459
  }
@@ -57578,9 +57589,6 @@ function createTypeChecker(host) {
57578
57589
  if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
57579
57590
  return objectType;
57580
57591
  }
57581
- if (indexType.flags & 131072 /* Never */) {
57582
- return neverType;
57583
- }
57584
57592
  const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
57585
57593
  if (indexInfo) {
57586
57594
  if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
@@ -57600,6 +57608,9 @@ function createTypeChecker(host) {
57600
57608
  }
57601
57609
  return indexInfo.type;
57602
57610
  }
57611
+ if (indexType.flags & 131072 /* Never */) {
57612
+ return neverType;
57613
+ }
57603
57614
  if (isJSLiteralType(objectType)) {
57604
57615
  return anyType;
57605
57616
  }
@@ -65699,16 +65710,7 @@ function createTypeChecker(host) {
65699
65710
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
65700
65711
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65701
65712
  } else if (expr.kind === 112 /* TrueKeyword */) {
65702
- const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
65703
- const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
65704
- if (clauseExpression) {
65705
- type = narrowType(
65706
- type,
65707
- clauseExpression,
65708
- /*assumeTrue*/
65709
- true
65710
- );
65711
- }
65713
+ type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
65712
65714
  } else {
65713
65715
  if (strictNullChecks) {
65714
65716
  if (optionalChainContainsReference(expr, reference)) {
@@ -66254,6 +66256,20 @@ function createTypeChecker(host) {
66254
66256
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
66255
66257
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
66256
66258
  }
66259
+ function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
66260
+ const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
66261
+ const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
66262
+ if (hasDefaultClause) {
66263
+ return type;
66264
+ }
66265
+ const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
66266
+ return getUnionType(map(clauses, (clause) => clause && clause.kind === 296 /* CaseClause */ ? narrowType(
66267
+ type,
66268
+ clause.expression,
66269
+ /*assumeTrue*/
66270
+ true
66271
+ ) : neverType));
66272
+ }
66257
66273
  function isMatchingConstructorReference(expr) {
66258
66274
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
66259
66275
  }
@@ -68820,7 +68836,7 @@ function createTypeChecker(host) {
68820
68836
  }
68821
68837
  }
68822
68838
  const parent = openingLikeElement.parent.kind === 284 /* JsxElement */ ? openingLikeElement.parent : void 0;
68823
- if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
68839
+ if (parent && parent.openingElement === openingLikeElement && getSemanticJsxChildren(parent.children).length > 0) {
68824
68840
  const childrenTypes = checkJsxChildren(parent, checkMode);
68825
68841
  if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
68826
68842
  if (explicitlySpecifyChildrenAttribute) {
@@ -70443,9 +70459,11 @@ function createTypeChecker(host) {
70443
70459
  }
70444
70460
  if (arg.kind === 237 /* SyntheticExpression */ && arg.tupleNameSource) {
70445
70461
  names.push(arg.tupleNameSource);
70462
+ } else {
70463
+ names.push(void 0);
70446
70464
  }
70447
70465
  }
70448
- return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), length(names) === length(types) ? names : void 0);
70466
+ return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), names);
70449
70467
  }
70450
70468
  function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
70451
70469
  const isJavascript = isInJSFile(signature.declaration);
@@ -72580,12 +72598,9 @@ function createTypeChecker(host) {
72580
72598
  types.push(restType);
72581
72599
  flags.push(8 /* Variadic */);
72582
72600
  }
72583
- const name = getNameableDeclarationAtPosition(source, i);
72584
- if (name) {
72585
- names.push(name);
72586
- }
72601
+ names.push(getNameableDeclarationAtPosition(source, i));
72587
72602
  }
72588
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
72603
+ return createTupleType(types, flags, readonly, names);
72589
72604
  }
72590
72605
  function getParameterCount(signature) {
72591
72606
  const length2 = signature.parameters.length;
package/lib/tsserver.js CHANGED
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-insiders.20231001`;
2331
+ var version = `${versionMajorMinor}.0-insiders.20231005`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -18197,6 +18197,7 @@ function getPropertyNameForPropertyNameNode(name) {
18197
18197
  case 81 /* PrivateIdentifier */:
18198
18198
  return name.escapedText;
18199
18199
  case 11 /* StringLiteral */:
18200
+ case 15 /* NoSubstitutionTemplateLiteral */:
18200
18201
  case 9 /* NumericLiteral */:
18201
18202
  return escapeLeadingUnderscores(name.text);
18202
18203
  case 167 /* ComputedPropertyName */:
@@ -47072,10 +47073,12 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
47072
47073
  importingSourceFile,
47073
47074
  host,
47074
47075
  userPreferences,
47075
- options
47076
+ options,
47077
+ /*forAutoImport*/
47078
+ false
47076
47079
  ).moduleSpecifiers;
47077
47080
  }
47078
- function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
47081
+ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
47079
47082
  let computedWithoutCache = false;
47080
47083
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
47081
47084
  if (ambient)
@@ -47093,11 +47096,19 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47093
47096
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
47094
47097
  computedWithoutCache = true;
47095
47098
  modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
47096
- const result = computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options);
47099
+ const result = computeModuleSpecifiers(
47100
+ modulePaths,
47101
+ compilerOptions,
47102
+ importingSourceFile,
47103
+ host,
47104
+ userPreferences,
47105
+ options,
47106
+ forAutoImport
47107
+ );
47097
47108
  cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
47098
47109
  return { moduleSpecifiers: result, computedWithoutCache };
47099
47110
  }
47100
- function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
47111
+ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
47101
47112
  const info = getInfo(importingSourceFile.path, host);
47102
47113
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
47103
47114
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
@@ -47154,7 +47165,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
47154
47165
  redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
47155
47166
  } else if (pathIsBareSpecifier(local)) {
47156
47167
  pathsSpecifiers = append(pathsSpecifiers, local);
47157
- } else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
47168
+ } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
47158
47169
  relativeSpecifiers = append(relativeSpecifiers, local);
47159
47170
  }
47160
47171
  }
@@ -62290,9 +62301,6 @@ function createTypeChecker(host) {
62290
62301
  if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
62291
62302
  return objectType;
62292
62303
  }
62293
- if (indexType.flags & 131072 /* Never */) {
62294
- return neverType;
62295
- }
62296
62304
  const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
62297
62305
  if (indexInfo) {
62298
62306
  if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
@@ -62312,6 +62320,9 @@ function createTypeChecker(host) {
62312
62320
  }
62313
62321
  return indexInfo.type;
62314
62322
  }
62323
+ if (indexType.flags & 131072 /* Never */) {
62324
+ return neverType;
62325
+ }
62315
62326
  if (isJSLiteralType(objectType)) {
62316
62327
  return anyType;
62317
62328
  }
@@ -70411,16 +70422,7 @@ function createTypeChecker(host) {
70411
70422
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
70412
70423
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70413
70424
  } else if (expr.kind === 112 /* TrueKeyword */) {
70414
- const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
70415
- const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
70416
- if (clauseExpression) {
70417
- type = narrowType(
70418
- type,
70419
- clauseExpression,
70420
- /*assumeTrue*/
70421
- true
70422
- );
70423
- }
70425
+ type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
70424
70426
  } else {
70425
70427
  if (strictNullChecks) {
70426
70428
  if (optionalChainContainsReference(expr, reference)) {
@@ -70966,6 +70968,20 @@ function createTypeChecker(host) {
70966
70968
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
70967
70969
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
70968
70970
  }
70971
+ function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
70972
+ const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
70973
+ const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
70974
+ if (hasDefaultClause) {
70975
+ return type;
70976
+ }
70977
+ const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
70978
+ return getUnionType(map(clauses, (clause) => clause && clause.kind === 296 /* CaseClause */ ? narrowType(
70979
+ type,
70980
+ clause.expression,
70981
+ /*assumeTrue*/
70982
+ true
70983
+ ) : neverType));
70984
+ }
70969
70985
  function isMatchingConstructorReference(expr) {
70970
70986
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
70971
70987
  }
@@ -73532,7 +73548,7 @@ function createTypeChecker(host) {
73532
73548
  }
73533
73549
  }
73534
73550
  const parent2 = openingLikeElement.parent.kind === 284 /* JsxElement */ ? openingLikeElement.parent : void 0;
73535
- if (parent2 && parent2.openingElement === openingLikeElement && parent2.children.length > 0) {
73551
+ if (parent2 && parent2.openingElement === openingLikeElement && getSemanticJsxChildren(parent2.children).length > 0) {
73536
73552
  const childrenTypes = checkJsxChildren(parent2, checkMode);
73537
73553
  if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
73538
73554
  if (explicitlySpecifyChildrenAttribute) {
@@ -75155,9 +75171,11 @@ function createTypeChecker(host) {
75155
75171
  }
75156
75172
  if (arg.kind === 237 /* SyntheticExpression */ && arg.tupleNameSource) {
75157
75173
  names.push(arg.tupleNameSource);
75174
+ } else {
75175
+ names.push(void 0);
75158
75176
  }
75159
75177
  }
75160
- return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), length(names) === length(types) ? names : void 0);
75178
+ return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), names);
75161
75179
  }
75162
75180
  function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
75163
75181
  const isJavascript = isInJSFile(signature.declaration);
@@ -77292,12 +77310,9 @@ function createTypeChecker(host) {
77292
77310
  types.push(restType);
77293
77311
  flags.push(8 /* Variadic */);
77294
77312
  }
77295
- const name = getNameableDeclarationAtPosition(source, i);
77296
- if (name) {
77297
- names.push(name);
77298
- }
77313
+ names.push(getNameableDeclarationAtPosition(source, i));
77299
77314
  }
77300
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
77315
+ return createTupleType(types, flags, readonly, names);
77301
77316
  }
77302
77317
  function getParameterCount(signature) {
77303
77318
  const length2 = signature.parameters.length;
@@ -143081,7 +143096,7 @@ function doChange7(sourceFile, changes, declaration, typeNode) {
143081
143096
  function getInfo4(context) {
143082
143097
  if (isInJSFile(context.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind))
143083
143098
  return;
143084
- const token = getTokenAtPosition(context.file, context.startPosition);
143099
+ const token = getTouchingPropertyName(context.file, context.startPosition);
143085
143100
  const declaration = findAncestor(token, (n) => isBlock(n) || n.parent && isArrowFunction(n.parent) && (n.kind === 39 /* EqualsGreaterThanToken */ || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n));
143086
143101
  if (!declaration || !declaration.body || declaration.type) {
143087
143102
  return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) };
@@ -150091,7 +150106,18 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
150091
150106
  const getChecker = createGetChecker(program, host);
150092
150107
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
150093
150108
  const rejectNodeModulesRelativePaths = moduleResolutionUsesNodeModules(moduleResolution);
150094
- const getModuleSpecifiers2 = fromCacheOnly ? (moduleSymbol) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (moduleSymbol, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences);
150109
+ const getModuleSpecifiers2 = fromCacheOnly ? (moduleSymbol) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (moduleSymbol, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
150110
+ moduleSymbol,
150111
+ checker,
150112
+ compilerOptions,
150113
+ sourceFile,
150114
+ moduleSpecifierResolutionHost,
150115
+ preferences,
150116
+ /*options*/
150117
+ void 0,
150118
+ /*forAutoImport*/
150119
+ true
150120
+ );
150095
150121
  let computedWithoutCacheCount = 0;
150096
150122
  const fixes = flatMap(exportInfo, (exportInfo2, i) => {
150097
150123
  const checker = getChecker(exportInfo2.isFromPackageJson);
@@ -158303,7 +158329,7 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
158303
158329
  return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal), "string" /* string */, typeof literal === "string" ? 8 /* stringLiteral */ : 7 /* numericLiteral */);
158304
158330
  }
158305
158331
  case "cases": {
158306
- const { entry, importAdder } = getExhaustiveCaseSnippets(
158332
+ const snippets = getExhaustiveCaseSnippets(
158307
158333
  contextToken.parent,
158308
158334
  sourceFile,
158309
158335
  preferences,
@@ -158313,7 +158339,8 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
158313
158339
  /*formatContext*/
158314
158340
  void 0
158315
158341
  );
158316
- if (importAdder.hasFixes()) {
158342
+ if (snippets == null ? void 0 : snippets.importAdder.hasFixes()) {
158343
+ const { entry, importAdder } = snippets;
158317
158344
  const changes = ts_textChanges_exports.ChangeTracker.with(
158318
158345
  { host, formatContext, preferences },
158319
158346
  importAdder.writeFixes
@@ -158331,7 +158358,7 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
158331
158358
  };
158332
158359
  }
158333
158360
  return {
158334
- name: entry.name,
158361
+ name,
158335
158362
  kind: "" /* unknown */,
158336
158363
  kindModifiers: "",
158337
158364
  displayParts: [],
@@ -164283,6 +164310,7 @@ function provideInlayHints(context) {
164283
164310
  const { file, program, span, cancellationToken, preferences } = context;
164284
164311
  const sourceFileText = file.text;
164285
164312
  const compilerOptions = program.getCompilerOptions();
164313
+ const quotePreference = getQuotePreference(file, preferences);
164286
164314
  const checker = program.getTypeChecker();
164287
164315
  const result = [];
164288
164316
  visitor(file);
@@ -164590,6 +164618,10 @@ function provideInlayHints(context) {
164590
164618
  parts.push({ text: tokenString });
164591
164619
  return;
164592
164620
  }
164621
+ if (isLiteralExpression(node)) {
164622
+ parts.push({ text: getLiteralText2(node) });
164623
+ return;
164624
+ }
164593
164625
  switch (node.kind) {
164594
164626
  case 80 /* Identifier */:
164595
164627
  const identifier = node;
@@ -164601,12 +164633,6 @@ function provideInlayHints(context) {
164601
164633
  parts.push({ text: identifierText });
164602
164634
  }
164603
164635
  break;
164604
- case 9 /* NumericLiteral */:
164605
- parts.push({ text: node.text });
164606
- break;
164607
- case 11 /* StringLiteral */:
164608
- parts.push({ text: `"${node.text}"` });
164609
- break;
164610
164636
  case 166 /* QualifiedName */:
164611
164637
  const qualifiedName = node;
164612
164638
  visitForDisplayParts(qualifiedName.left);
@@ -164862,6 +164888,12 @@ function provideInlayHints(context) {
164862
164888
  visitForDisplayParts(node);
164863
164889
  });
164864
164890
  }
164891
+ function getLiteralText2(node) {
164892
+ if (isStringLiteral(node)) {
164893
+ return quotePreference === 0 /* Single */ ? `'${escapeString(node.text, 39 /* singleQuote */)}'` : `"${escapeString(node.text, 34 /* doubleQuote */)}"`;
164894
+ }
164895
+ return node.text;
164896
+ }
164865
164897
  }
164866
164898
  function isUndefined(name) {
164867
164899
  return name === "undefined";
@@ -4976,7 +4976,7 @@ declare namespace ts {
4976
4976
  readonly right: Identifier;
4977
4977
  }
4978
4978
  type EntityName = Identifier | QualifiedName;
4979
- type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
4979
+ type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
4980
4980
  type MemberName = Identifier | PrivateIdentifier;
4981
4981
  type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
4982
4982
  interface Declaration extends Node {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-insiders.20231001`;
38
+ version = `${versionMajorMinor}.0-insiders.20231005`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -15566,6 +15566,7 @@ ${lanes.join("\n")}
15566
15566
  case 81 /* PrivateIdentifier */:
15567
15567
  return name.escapedText;
15568
15568
  case 11 /* StringLiteral */:
15569
+ case 15 /* NoSubstitutionTemplateLiteral */:
15569
15570
  case 9 /* NumericLiteral */:
15570
15571
  return escapeLeadingUnderscores(name.text);
15571
15572
  case 167 /* ComputedPropertyName */:
@@ -44937,10 +44938,12 @@ ${lanes.join("\n")}
44937
44938
  importingSourceFile,
44938
44939
  host,
44939
44940
  userPreferences,
44940
- options
44941
+ options,
44942
+ /*forAutoImport*/
44943
+ false
44941
44944
  ).moduleSpecifiers;
44942
44945
  }
44943
- function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
44946
+ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
44944
44947
  let computedWithoutCache = false;
44945
44948
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
44946
44949
  if (ambient)
@@ -44958,11 +44961,19 @@ ${lanes.join("\n")}
44958
44961
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
44959
44962
  computedWithoutCache = true;
44960
44963
  modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
44961
- const result = computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options);
44964
+ const result = computeModuleSpecifiers(
44965
+ modulePaths,
44966
+ compilerOptions,
44967
+ importingSourceFile,
44968
+ host,
44969
+ userPreferences,
44970
+ options,
44971
+ forAutoImport
44972
+ );
44962
44973
  cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
44963
44974
  return { moduleSpecifiers: result, computedWithoutCache };
44964
44975
  }
44965
- function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
44976
+ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
44966
44977
  const info = getInfo(importingSourceFile.path, host);
44967
44978
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
44968
44979
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
@@ -45019,7 +45030,7 @@ ${lanes.join("\n")}
45019
45030
  redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
45020
45031
  } else if (pathIsBareSpecifier(local)) {
45021
45032
  pathsSpecifiers = append(pathsSpecifiers, local);
45022
- } else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
45033
+ } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
45023
45034
  relativeSpecifiers = append(relativeSpecifiers, local);
45024
45035
  }
45025
45036
  }
@@ -60057,9 +60068,6 @@ ${lanes.join("\n")}
60057
60068
  if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
60058
60069
  return objectType;
60059
60070
  }
60060
- if (indexType.flags & 131072 /* Never */) {
60061
- return neverType;
60062
- }
60063
60071
  const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
60064
60072
  if (indexInfo) {
60065
60073
  if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
@@ -60079,6 +60087,9 @@ ${lanes.join("\n")}
60079
60087
  }
60080
60088
  return indexInfo.type;
60081
60089
  }
60090
+ if (indexType.flags & 131072 /* Never */) {
60091
+ return neverType;
60092
+ }
60082
60093
  if (isJSLiteralType(objectType)) {
60083
60094
  return anyType;
60084
60095
  }
@@ -68178,16 +68189,7 @@ ${lanes.join("\n")}
68178
68189
  } else if (expr.kind === 221 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
68179
68190
  type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68180
68191
  } else if (expr.kind === 112 /* TrueKeyword */) {
68181
- const clause = flow.switchStatement.caseBlock.clauses.find((_, index) => index === flow.clauseStart);
68182
- const clauseExpression = clause && clause.kind === 296 /* CaseClause */ ? clause.expression : void 0;
68183
- if (clauseExpression) {
68184
- type = narrowType(
68185
- type,
68186
- clauseExpression,
68187
- /*assumeTrue*/
68188
- true
68189
- );
68190
- }
68192
+ type = narrowTypeBySwitchOnTrue(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
68191
68193
  } else {
68192
68194
  if (strictNullChecks) {
68193
68195
  if (optionalChainContainsReference(expr, reference)) {
@@ -68733,6 +68735,20 @@ ${lanes.join("\n")}
68733
68735
  const clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
68734
68736
  return getUnionType(map(clauseWitnesses, (text) => text ? narrowTypeByTypeName(type, text) : neverType));
68735
68737
  }
68738
+ function narrowTypeBySwitchOnTrue(type, switchStatement, clauseStart, clauseEnd) {
68739
+ const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 297 /* DefaultClause */);
68740
+ const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd;
68741
+ if (hasDefaultClause) {
68742
+ return type;
68743
+ }
68744
+ const clauses = switchStatement.caseBlock.clauses.slice(clauseStart, clauseEnd);
68745
+ return getUnionType(map(clauses, (clause) => clause && clause.kind === 296 /* CaseClause */ ? narrowType(
68746
+ type,
68747
+ clause.expression,
68748
+ /*assumeTrue*/
68749
+ true
68750
+ ) : neverType));
68751
+ }
68736
68752
  function isMatchingConstructorReference(expr) {
68737
68753
  return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression);
68738
68754
  }
@@ -71299,7 +71315,7 @@ ${lanes.join("\n")}
71299
71315
  }
71300
71316
  }
71301
71317
  const parent2 = openingLikeElement.parent.kind === 284 /* JsxElement */ ? openingLikeElement.parent : void 0;
71302
- if (parent2 && parent2.openingElement === openingLikeElement && parent2.children.length > 0) {
71318
+ if (parent2 && parent2.openingElement === openingLikeElement && getSemanticJsxChildren(parent2.children).length > 0) {
71303
71319
  const childrenTypes = checkJsxChildren(parent2, checkMode);
71304
71320
  if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
71305
71321
  if (explicitlySpecifyChildrenAttribute) {
@@ -72922,9 +72938,11 @@ ${lanes.join("\n")}
72922
72938
  }
72923
72939
  if (arg.kind === 237 /* SyntheticExpression */ && arg.tupleNameSource) {
72924
72940
  names.push(arg.tupleNameSource);
72941
+ } else {
72942
+ names.push(void 0);
72925
72943
  }
72926
72944
  }
72927
- return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), length(names) === length(types) ? names : void 0);
72945
+ return createTupleType(types, flags, inConstContext && !someType(restType, isMutableArrayLikeType), names);
72928
72946
  }
72929
72947
  function checkTypeArguments(signature, typeArgumentNodes, reportErrors2, headMessage) {
72930
72948
  const isJavascript = isInJSFile(signature.declaration);
@@ -75059,12 +75077,9 @@ ${lanes.join("\n")}
75059
75077
  types.push(restType);
75060
75078
  flags.push(8 /* Variadic */);
75061
75079
  }
75062
- const name = getNameableDeclarationAtPosition(source, i);
75063
- if (name) {
75064
- names.push(name);
75065
- }
75080
+ names.push(getNameableDeclarationAtPosition(source, i));
75066
75081
  }
75067
- return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
75082
+ return createTupleType(types, flags, readonly, names);
75068
75083
  }
75069
75084
  function getParameterCount(signature) {
75070
75085
  const length2 = signature.parameters.length;
@@ -141597,7 +141612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
141597
141612
  function getInfo4(context) {
141598
141613
  if (isInJSFile(context.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind))
141599
141614
  return;
141600
- const token = getTokenAtPosition(context.file, context.startPosition);
141615
+ const token = getTouchingPropertyName(context.file, context.startPosition);
141601
141616
  const declaration = findAncestor(token, (n) => isBlock(n) || n.parent && isArrowFunction(n.parent) && (n.kind === 39 /* EqualsGreaterThanToken */ || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n));
141602
141617
  if (!declaration || !declaration.body || declaration.type) {
141603
141618
  return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) };
@@ -148811,7 +148826,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148811
148826
  const getChecker = createGetChecker(program, host);
148812
148827
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
148813
148828
  const rejectNodeModulesRelativePaths = moduleResolutionUsesNodeModules(moduleResolution);
148814
- const getModuleSpecifiers2 = fromCacheOnly ? (moduleSymbol) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (moduleSymbol, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences);
148829
+ const getModuleSpecifiers2 = fromCacheOnly ? (moduleSymbol) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (moduleSymbol, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
148830
+ moduleSymbol,
148831
+ checker,
148832
+ compilerOptions,
148833
+ sourceFile,
148834
+ moduleSpecifierResolutionHost,
148835
+ preferences,
148836
+ /*options*/
148837
+ void 0,
148838
+ /*forAutoImport*/
148839
+ true
148840
+ );
148815
148841
  let computedWithoutCacheCount = 0;
148816
148842
  const fixes = flatMap(exportInfo, (exportInfo2, i) => {
148817
148843
  const checker = getChecker(exportInfo2.isFromPackageJson);
@@ -157527,7 +157553,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157527
157553
  return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal), "string" /* string */, typeof literal === "string" ? 8 /* stringLiteral */ : 7 /* numericLiteral */);
157528
157554
  }
157529
157555
  case "cases": {
157530
- const { entry, importAdder } = getExhaustiveCaseSnippets(
157556
+ const snippets = getExhaustiveCaseSnippets(
157531
157557
  contextToken.parent,
157532
157558
  sourceFile,
157533
157559
  preferences,
@@ -157537,7 +157563,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157537
157563
  /*formatContext*/
157538
157564
  void 0
157539
157565
  );
157540
- if (importAdder.hasFixes()) {
157566
+ if (snippets == null ? void 0 : snippets.importAdder.hasFixes()) {
157567
+ const { entry, importAdder } = snippets;
157541
157568
  const changes = ts_textChanges_exports.ChangeTracker.with(
157542
157569
  { host, formatContext, preferences },
157543
157570
  importAdder.writeFixes
@@ -157555,7 +157582,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157555
157582
  };
157556
157583
  }
157557
157584
  return {
157558
- name: entry.name,
157585
+ name,
157559
157586
  kind: "" /* unknown */,
157560
157587
  kindModifiers: "",
157561
157588
  displayParts: [],
@@ -163628,6 +163655,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163628
163655
  const { file, program, span, cancellationToken, preferences } = context;
163629
163656
  const sourceFileText = file.text;
163630
163657
  const compilerOptions = program.getCompilerOptions();
163658
+ const quotePreference = getQuotePreference(file, preferences);
163631
163659
  const checker = program.getTypeChecker();
163632
163660
  const result = [];
163633
163661
  visitor(file);
@@ -163935,6 +163963,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163935
163963
  parts.push({ text: tokenString });
163936
163964
  return;
163937
163965
  }
163966
+ if (isLiteralExpression(node)) {
163967
+ parts.push({ text: getLiteralText2(node) });
163968
+ return;
163969
+ }
163938
163970
  switch (node.kind) {
163939
163971
  case 80 /* Identifier */:
163940
163972
  const identifier = node;
@@ -163946,12 +163978,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163946
163978
  parts.push({ text: identifierText });
163947
163979
  }
163948
163980
  break;
163949
- case 9 /* NumericLiteral */:
163950
- parts.push({ text: node.text });
163951
- break;
163952
- case 11 /* StringLiteral */:
163953
- parts.push({ text: `"${node.text}"` });
163954
- break;
163955
163981
  case 166 /* QualifiedName */:
163956
163982
  const qualifiedName = node;
163957
163983
  visitForDisplayParts(qualifiedName.left);
@@ -164207,6 +164233,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164207
164233
  visitForDisplayParts(node);
164208
164234
  });
164209
164235
  }
164236
+ function getLiteralText2(node) {
164237
+ if (isStringLiteral(node)) {
164238
+ return quotePreference === 0 /* Single */ ? `'${escapeString(node.text, 39 /* singleQuote */)}'` : `"${escapeString(node.text, 34 /* doubleQuote */)}"`;
164239
+ }
164240
+ return node.text;
164241
+ }
164210
164242
  }
164211
164243
  function isUndefined(name) {
164212
164244
  return name === "undefined";
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.3";
57
- var version = `${versionMajorMinor}.0-insiders.20231001`;
57
+ var version = `${versionMajorMinor}.0-insiders.20231005`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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": "5.3.0-pr-55842-7",
5
+ "version": "5.3.0-pr-55991-5",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "a440f573a7cd8fa23e7afbdad2e017331e98b8c7"
117
+ "gitHead": "d6e8e9dfe6243d3e73908b31287e71991fedfad1"
118
118
  }