typescript 5.8.0-dev.20241203 → 5.8.0-dev.20241205

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.8";
21
- var version = `${versionMajorMinor}.0-dev.20241203`;
21
+ var version = `${versionMajorMinor}.0-dev.20241205`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11144,6 +11144,7 @@ function sortAndDeduplicateDiagnostics(diagnostics) {
11144
11144
  }
11145
11145
  var targetToLibMap = /* @__PURE__ */ new Map([
11146
11146
  [99 /* ESNext */, "lib.esnext.full.d.ts"],
11147
+ [11 /* ES2024 */, "lib.es2024.full.d.ts"],
11147
11148
  [10 /* ES2023 */, "lib.es2023.full.d.ts"],
11148
11149
  [9 /* ES2022 */, "lib.es2022.full.d.ts"],
11149
11150
  [8 /* ES2021 */, "lib.es2021.full.d.ts"],
@@ -11159,6 +11160,7 @@ function getDefaultLibFileName(options) {
11159
11160
  const target = getEmitScriptTarget(options);
11160
11161
  switch (target) {
11161
11162
  case 99 /* ESNext */:
11163
+ case 11 /* ES2024 */:
11162
11164
  case 10 /* ES2023 */:
11163
11165
  case 9 /* ES2022 */:
11164
11166
  case 8 /* ES2021 */:
@@ -42324,6 +42326,9 @@ function createBinder() {
42324
42326
  const saveInAssignmentPattern = inAssignmentPattern;
42325
42327
  inAssignmentPattern = false;
42326
42328
  if (checkUnreachable(node)) {
42329
+ if (canHaveFlowNode(node) && node.flowNode) {
42330
+ node.flowNode = void 0;
42331
+ }
42327
42332
  bindEachChild(node);
42328
42333
  bindJSDoc(node);
42329
42334
  inAssignmentPattern = saveInAssignmentPattern;
@@ -46795,6 +46800,12 @@ function createTypeChecker(host) {
46795
46800
  /*isReadonly*/
46796
46801
  true
46797
46802
  );
46803
+ var anyBaseTypeIndexInfo = createIndexInfo(
46804
+ stringType,
46805
+ anyType,
46806
+ /*isReadonly*/
46807
+ false
46808
+ );
46798
46809
  var iterationTypesCache = /* @__PURE__ */ new Map();
46799
46810
  var noIterationTypes = {
46800
46811
  get yieldType() {
@@ -56737,12 +56748,7 @@ function createTypeChecker(host) {
56737
56748
  addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
56738
56749
  callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));
56739
56750
  constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));
56740
- const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo(
56741
- stringType,
56742
- anyType,
56743
- /*isReadonly*/
56744
- false
56745
- )];
56751
+ const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [anyBaseTypeIndexInfo];
56746
56752
  indexInfos = concatenate(indexInfos, filter(inheritedIndexInfos, (info) => !findIndexInfo(indexInfos, info.keyType)));
56747
56753
  }
56748
56754
  }
@@ -57268,12 +57274,7 @@ function createTypeChecker(host) {
57268
57274
  members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
57269
57275
  addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57270
57276
  } else if (baseConstructorType === anyType) {
57271
- baseConstructorIndexInfo = createIndexInfo(
57272
- stringType,
57273
- anyType,
57274
- /*isReadonly*/
57275
- false
57276
- );
57277
+ baseConstructorIndexInfo = anyBaseTypeIndexInfo;
57277
57278
  }
57278
57279
  }
57279
57280
  const indexSymbol = getIndexSymbolFromSymbolTable(members);
@@ -70691,8 +70692,9 @@ function createTypeChecker(host) {
70691
70692
  }
70692
70693
  if (isJsxOpeningFragment(node)) {
70693
70694
  const file = getSourceFileOfNode(node);
70694
- const localJsxNamespace = getLocalJsxNamespace(file);
70695
- if (localJsxNamespace) {
70695
+ const entity = getJsxFactoryEntity(file);
70696
+ if (entity) {
70697
+ const localJsxNamespace = getFirstIdentifier(entity).escapedText;
70696
70698
  resolveName(
70697
70699
  jsxFactoryLocation,
70698
70700
  localJsxNamespace,
@@ -74271,6 +74273,13 @@ function createTypeChecker(host) {
74271
74273
  return getIntersectionType(x);
74272
74274
  }
74273
74275
  function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
74276
+ const links = getNodeLinks(propNode);
74277
+ const cache = links.nonExistentPropCheckCache || (links.nonExistentPropCheckCache = /* @__PURE__ */ new Set());
74278
+ const key = `${getTypeId(containingType)}|${isUncheckedJS}`;
74279
+ if (cache.has(key)) {
74280
+ return;
74281
+ }
74282
+ cache.add(key);
74274
74283
  let errorInfo;
74275
74284
  let relatedInfo;
74276
74285
  if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) {
@@ -85144,7 +85153,7 @@ function createTypeChecker(host) {
85144
85153
  }
85145
85154
  }
85146
85155
  }
85147
- if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
85156
+ if (moduleKind === 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
85148
85157
  error(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
85149
85158
  }
85150
85159
  } else if (noUncheckedSideEffectImports && !importClause) {
@@ -87428,6 +87437,7 @@ function createTypeChecker(host) {
87428
87437
  result || (result = []);
87429
87438
  for (const info of infoList) {
87430
87439
  if (info.declaration) continue;
87440
+ if (info === anyBaseTypeIndexInfo) continue;
87431
87441
  const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
87432
87442
  if (node && infoList === staticInfos) {
87433
87443
  (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
@@ -132145,9 +132155,9 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132145
132155
  }
132146
132156
  if (!result && node.kind === 303 /* PropertyAssignment */) {
132147
132157
  const initializer = node.initializer;
132148
- const type = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
132149
- if (type && !isConstTypeReference(type)) {
132150
- result = serializeExistingTypeNode(type, context);
132158
+ const assertionNode = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
132159
+ if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context, node, assertionNode, symbol)) {
132160
+ result = serializeExistingTypeNode(assertionNode, context);
132151
132161
  }
132152
132162
  }
132153
132163
  return result ?? inferTypeOfDeclaration(
package/lib/typescript.js CHANGED
@@ -2278,7 +2278,7 @@ module.exports = __toCommonJS(typescript_exports);
2278
2278
 
2279
2279
  // src/compiler/corePublic.ts
2280
2280
  var versionMajorMinor = "5.8";
2281
- var version = `${versionMajorMinor}.0-dev.20241203`;
2281
+ var version = `${versionMajorMinor}.0-dev.20241205`;
2282
2282
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2283
2283
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2284
2284
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -14549,6 +14549,7 @@ function sortAndDeduplicateDiagnostics(diagnostics) {
14549
14549
  }
14550
14550
  var targetToLibMap = /* @__PURE__ */ new Map([
14551
14551
  [99 /* ESNext */, "lib.esnext.full.d.ts"],
14552
+ [11 /* ES2024 */, "lib.es2024.full.d.ts"],
14552
14553
  [10 /* ES2023 */, "lib.es2023.full.d.ts"],
14553
14554
  [9 /* ES2022 */, "lib.es2022.full.d.ts"],
14554
14555
  [8 /* ES2021 */, "lib.es2021.full.d.ts"],
@@ -14564,6 +14565,7 @@ function getDefaultLibFileName(options) {
14564
14565
  const target = getEmitScriptTarget(options);
14565
14566
  switch (target) {
14566
14567
  case 99 /* ESNext */:
14568
+ case 11 /* ES2024 */:
14567
14569
  case 10 /* ES2023 */:
14568
14570
  case 9 /* ES2022 */:
14569
14571
  case 8 /* ES2021 */:
@@ -46828,6 +46830,9 @@ function createBinder() {
46828
46830
  const saveInAssignmentPattern = inAssignmentPattern;
46829
46831
  inAssignmentPattern = false;
46830
46832
  if (checkUnreachable(node)) {
46833
+ if (canHaveFlowNode(node) && node.flowNode) {
46834
+ node.flowNode = void 0;
46835
+ }
46831
46836
  bindEachChild(node);
46832
46837
  bindJSDoc(node);
46833
46838
  inAssignmentPattern = saveInAssignmentPattern;
@@ -51399,6 +51404,12 @@ function createTypeChecker(host) {
51399
51404
  /*isReadonly*/
51400
51405
  true
51401
51406
  );
51407
+ var anyBaseTypeIndexInfo = createIndexInfo(
51408
+ stringType,
51409
+ anyType,
51410
+ /*isReadonly*/
51411
+ false
51412
+ );
51402
51413
  var iterationTypesCache = /* @__PURE__ */ new Map();
51403
51414
  var noIterationTypes = {
51404
51415
  get yieldType() {
@@ -61341,12 +61352,7 @@ function createTypeChecker(host) {
61341
61352
  addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
61342
61353
  callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));
61343
61354
  constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));
61344
- const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo(
61345
- stringType,
61346
- anyType,
61347
- /*isReadonly*/
61348
- false
61349
- )];
61355
+ const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [anyBaseTypeIndexInfo];
61350
61356
  indexInfos = concatenate(indexInfos, filter(inheritedIndexInfos, (info) => !findIndexInfo(indexInfos, info.keyType)));
61351
61357
  }
61352
61358
  }
@@ -61872,12 +61878,7 @@ function createTypeChecker(host) {
61872
61878
  members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
61873
61879
  addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
61874
61880
  } else if (baseConstructorType === anyType) {
61875
- baseConstructorIndexInfo = createIndexInfo(
61876
- stringType,
61877
- anyType,
61878
- /*isReadonly*/
61879
- false
61880
- );
61881
+ baseConstructorIndexInfo = anyBaseTypeIndexInfo;
61881
61882
  }
61882
61883
  }
61883
61884
  const indexSymbol = getIndexSymbolFromSymbolTable(members);
@@ -75295,8 +75296,9 @@ function createTypeChecker(host) {
75295
75296
  }
75296
75297
  if (isJsxOpeningFragment(node)) {
75297
75298
  const file = getSourceFileOfNode(node);
75298
- const localJsxNamespace = getLocalJsxNamespace(file);
75299
- if (localJsxNamespace) {
75299
+ const entity = getJsxFactoryEntity(file);
75300
+ if (entity) {
75301
+ const localJsxNamespace = getFirstIdentifier(entity).escapedText;
75300
75302
  resolveName(
75301
75303
  jsxFactoryLocation,
75302
75304
  localJsxNamespace,
@@ -78875,6 +78877,13 @@ function createTypeChecker(host) {
78875
78877
  return getIntersectionType(x);
78876
78878
  }
78877
78879
  function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
78880
+ const links = getNodeLinks(propNode);
78881
+ const cache = links.nonExistentPropCheckCache || (links.nonExistentPropCheckCache = /* @__PURE__ */ new Set());
78882
+ const key = `${getTypeId(containingType)}|${isUncheckedJS}`;
78883
+ if (cache.has(key)) {
78884
+ return;
78885
+ }
78886
+ cache.add(key);
78878
78887
  let errorInfo;
78879
78888
  let relatedInfo;
78880
78889
  if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) {
@@ -89748,7 +89757,7 @@ function createTypeChecker(host) {
89748
89757
  }
89749
89758
  }
89750
89759
  }
89751
- if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
89760
+ if (moduleKind === 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
89752
89761
  error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
89753
89762
  }
89754
89763
  } else if (noUncheckedSideEffectImports && !importClause) {
@@ -92032,6 +92041,7 @@ function createTypeChecker(host) {
92032
92041
  result || (result = []);
92033
92042
  for (const info of infoList) {
92034
92043
  if (info.declaration) continue;
92044
+ if (info === anyBaseTypeIndexInfo) continue;
92035
92045
  const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
92036
92046
  if (node && infoList === staticInfos) {
92037
92047
  (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
@@ -137106,9 +137116,9 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137106
137116
  }
137107
137117
  if (!result && node.kind === 303 /* PropertyAssignment */) {
137108
137118
  const initializer = node.initializer;
137109
- const type = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
137110
- if (type && !isConstTypeReference(type)) {
137111
- result = serializeExistingTypeNode(type, context);
137119
+ const assertionNode = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
137120
+ if (assertionNode && !isConstTypeReference(assertionNode) && resolver.canReuseTypeNodeAnnotation(context, node, assertionNode, symbol)) {
137121
+ result = serializeExistingTypeNode(assertionNode, context);
137112
137122
  }
137113
137123
  }
137114
137124
  return result ?? inferTypeOfDeclaration(
@@ -157310,6 +157320,7 @@ var errorCodes19 = [
157310
157320
  Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
157311
157321
  Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
157312
157322
  Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
157323
+ Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code,
157313
157324
  Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
157314
157325
  ];
157315
157326
  registerCodeFix({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.8.0-dev.20241203",
5
+ "version": "5.8.0-dev.20241205",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "14c65b311959501b6720ff48b9cb02eecbcee4a7"
119
+ "gitHead": "12d96878bc51df4b1707b6f92f5094f51513a16d"
120
120
  }