typescript 5.8.0-dev.20241204 → 5.8.0-dev.20241206

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.20241204`;
21
+ var version = `${versionMajorMinor}.0-dev.20241206`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -42326,6 +42326,9 @@ function createBinder() {
42326
42326
  const saveInAssignmentPattern = inAssignmentPattern;
42327
42327
  inAssignmentPattern = false;
42328
42328
  if (checkUnreachable(node)) {
42329
+ if (canHaveFlowNode(node) && node.flowNode) {
42330
+ node.flowNode = void 0;
42331
+ }
42329
42332
  bindEachChild(node);
42330
42333
  bindJSDoc(node);
42331
42334
  inAssignmentPattern = saveInAssignmentPattern;
@@ -46797,6 +46800,12 @@ function createTypeChecker(host) {
46797
46800
  /*isReadonly*/
46798
46801
  true
46799
46802
  );
46803
+ var anyBaseTypeIndexInfo = createIndexInfo(
46804
+ stringType,
46805
+ anyType,
46806
+ /*isReadonly*/
46807
+ false
46808
+ );
46800
46809
  var iterationTypesCache = /* @__PURE__ */ new Map();
46801
46810
  var noIterationTypes = {
46802
46811
  get yieldType() {
@@ -56739,12 +56748,7 @@ function createTypeChecker(host) {
56739
56748
  addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
56740
56749
  callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));
56741
56750
  constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));
56742
- const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo(
56743
- stringType,
56744
- anyType,
56745
- /*isReadonly*/
56746
- false
56747
- )];
56751
+ const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [anyBaseTypeIndexInfo];
56748
56752
  indexInfos = concatenate(indexInfos, filter(inheritedIndexInfos, (info) => !findIndexInfo(indexInfos, info.keyType)));
56749
56753
  }
56750
56754
  }
@@ -57270,12 +57274,7 @@ function createTypeChecker(host) {
57270
57274
  members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
57271
57275
  addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
57272
57276
  } else if (baseConstructorType === anyType) {
57273
- baseConstructorIndexInfo = createIndexInfo(
57274
- stringType,
57275
- anyType,
57276
- /*isReadonly*/
57277
- false
57278
- );
57277
+ baseConstructorIndexInfo = anyBaseTypeIndexInfo;
57279
57278
  }
57280
57279
  }
57281
57280
  const indexSymbol = getIndexSymbolFromSymbolTable(members);
@@ -70693,8 +70692,9 @@ function createTypeChecker(host) {
70693
70692
  }
70694
70693
  if (isJsxOpeningFragment(node)) {
70695
70694
  const file = getSourceFileOfNode(node);
70696
- const localJsxNamespace = getLocalJsxNamespace(file);
70697
- if (localJsxNamespace) {
70695
+ const entity = getJsxFactoryEntity(file);
70696
+ if (entity) {
70697
+ const localJsxNamespace = getFirstIdentifier(entity).escapedText;
70698
70698
  resolveName(
70699
70699
  jsxFactoryLocation,
70700
70700
  localJsxNamespace,
@@ -74273,6 +74273,13 @@ function createTypeChecker(host) {
74273
74273
  return getIntersectionType(x);
74274
74274
  }
74275
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);
74276
74283
  let errorInfo;
74277
74284
  let relatedInfo;
74278
74285
  if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) {
@@ -85146,7 +85153,7 @@ function createTypeChecker(host) {
85146
85153
  }
85147
85154
  }
85148
85155
  }
85149
- if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
85156
+ if (moduleKind === 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
85150
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]);
85151
85158
  }
85152
85159
  } else if (noUncheckedSideEffectImports && !importClause) {
@@ -87430,6 +87437,7 @@ function createTypeChecker(host) {
87430
87437
  result || (result = []);
87431
87438
  for (const info of infoList) {
87432
87439
  if (info.declaration) continue;
87440
+ if (info === anyBaseTypeIndexInfo) continue;
87433
87441
  const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
87434
87442
  if (node && infoList === staticInfos) {
87435
87443
  (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
@@ -132147,9 +132155,9 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132147
132155
  }
132148
132156
  if (!result && node.kind === 303 /* PropertyAssignment */) {
132149
132157
  const initializer = node.initializer;
132150
- const type = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
132151
- if (type && !isConstTypeReference(type)) {
132152
- 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);
132153
132161
  }
132154
132162
  }
132155
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.20241204`;
2281
+ var version = `${versionMajorMinor}.0-dev.20241206`;
2282
2282
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2283
2283
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2284
2284
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -46830,6 +46830,9 @@ function createBinder() {
46830
46830
  const saveInAssignmentPattern = inAssignmentPattern;
46831
46831
  inAssignmentPattern = false;
46832
46832
  if (checkUnreachable(node)) {
46833
+ if (canHaveFlowNode(node) && node.flowNode) {
46834
+ node.flowNode = void 0;
46835
+ }
46833
46836
  bindEachChild(node);
46834
46837
  bindJSDoc(node);
46835
46838
  inAssignmentPattern = saveInAssignmentPattern;
@@ -51401,6 +51404,12 @@ function createTypeChecker(host) {
51401
51404
  /*isReadonly*/
51402
51405
  true
51403
51406
  );
51407
+ var anyBaseTypeIndexInfo = createIndexInfo(
51408
+ stringType,
51409
+ anyType,
51410
+ /*isReadonly*/
51411
+ false
51412
+ );
51404
51413
  var iterationTypesCache = /* @__PURE__ */ new Map();
51405
51414
  var noIterationTypes = {
51406
51415
  get yieldType() {
@@ -61343,12 +61352,7 @@ function createTypeChecker(host) {
61343
61352
  addInheritedMembers(members, getPropertiesOfType(instantiatedBaseType));
61344
61353
  callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0 /* Call */));
61345
61354
  constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1 /* Construct */));
61346
- const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [createIndexInfo(
61347
- stringType,
61348
- anyType,
61349
- /*isReadonly*/
61350
- false
61351
- )];
61355
+ const inheritedIndexInfos = instantiatedBaseType !== anyType ? getIndexInfosOfType(instantiatedBaseType) : [anyBaseTypeIndexInfo];
61352
61356
  indexInfos = concatenate(indexInfos, filter(inheritedIndexInfos, (info) => !findIndexInfo(indexInfos, info.keyType)));
61353
61357
  }
61354
61358
  }
@@ -61874,12 +61878,7 @@ function createTypeChecker(host) {
61874
61878
  members = createSymbolTable(getNamedOrIndexSignatureMembers(members));
61875
61879
  addInheritedMembers(members, getPropertiesOfType(baseConstructorType));
61876
61880
  } else if (baseConstructorType === anyType) {
61877
- baseConstructorIndexInfo = createIndexInfo(
61878
- stringType,
61879
- anyType,
61880
- /*isReadonly*/
61881
- false
61882
- );
61881
+ baseConstructorIndexInfo = anyBaseTypeIndexInfo;
61883
61882
  }
61884
61883
  }
61885
61884
  const indexSymbol = getIndexSymbolFromSymbolTable(members);
@@ -75297,8 +75296,9 @@ function createTypeChecker(host) {
75297
75296
  }
75298
75297
  if (isJsxOpeningFragment(node)) {
75299
75298
  const file = getSourceFileOfNode(node);
75300
- const localJsxNamespace = getLocalJsxNamespace(file);
75301
- if (localJsxNamespace) {
75299
+ const entity = getJsxFactoryEntity(file);
75300
+ if (entity) {
75301
+ const localJsxNamespace = getFirstIdentifier(entity).escapedText;
75302
75302
  resolveName(
75303
75303
  jsxFactoryLocation,
75304
75304
  localJsxNamespace,
@@ -78877,6 +78877,13 @@ function createTypeChecker(host) {
78877
78877
  return getIntersectionType(x);
78878
78878
  }
78879
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);
78880
78887
  let errorInfo;
78881
78888
  let relatedInfo;
78882
78889
  if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) {
@@ -89750,7 +89757,7 @@ function createTypeChecker(host) {
89750
89757
  }
89751
89758
  }
89752
89759
  }
89753
- if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
89760
+ if (moduleKind === 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
89754
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]);
89755
89762
  }
89756
89763
  } else if (noUncheckedSideEffectImports && !importClause) {
@@ -92034,6 +92041,7 @@ function createTypeChecker(host) {
92034
92041
  result || (result = []);
92035
92042
  for (const info of infoList) {
92036
92043
  if (info.declaration) continue;
92044
+ if (info === anyBaseTypeIndexInfo) continue;
92037
92045
  const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
92038
92046
  if (node && infoList === staticInfos) {
92039
92047
  (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
@@ -137108,9 +137116,9 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137108
137116
  }
137109
137117
  if (!result && node.kind === 303 /* PropertyAssignment */) {
137110
137118
  const initializer = node.initializer;
137111
- const type = isJSDocTypeAssertion(initializer) ? getJSDocTypeAssertionType(initializer) : initializer.kind === 234 /* AsExpression */ || initializer.kind === 216 /* TypeAssertionExpression */ ? initializer.type : void 0;
137112
- if (type && !isConstTypeReference(type)) {
137113
- 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);
137114
137122
  }
137115
137123
  }
137116
137124
  return result ?? inferTypeOfDeclaration(
@@ -157312,6 +157320,7 @@ var errorCodes19 = [
157312
157320
  Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
157313
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,
157314
157322
  Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
157323
+ Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code,
157315
157324
  Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
157316
157325
  ];
157317
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.20241204",
5
+ "version": "5.8.0-dev.20241206",
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": "6f75783184328087627da983fe30a05fca4f6314"
119
+ "gitHead": "edd278a10415476afb90f3f0523e132805626e52"
120
120
  }