typescript 5.6.0-dev.20240719 → 5.6.0-dev.20240720

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/typescript.js CHANGED
@@ -1675,6 +1675,7 @@ __export(typescript_exports, {
1675
1675
  isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
1676
1676
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
1677
1677
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
1678
+ isSideEffectImport: () => isSideEffectImport,
1678
1679
  isSignedNumericLiteral: () => isSignedNumericLiteral,
1679
1680
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
1680
1681
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
@@ -2256,7 +2257,7 @@ module.exports = __toCommonJS(typescript_exports);
2256
2257
 
2257
2258
  // src/compiler/corePublic.ts
2258
2259
  var versionMajorMinor = "5.6";
2259
- var version = `${versionMajorMinor}.0-dev.20240719`;
2260
+ var version = `${versionMajorMinor}.0-dev.20240720`;
2260
2261
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2261
2262
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2262
2263
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9510,6 +9511,7 @@ var Diagnostics = {
9510
9511
  Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
9511
9512
  Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
9512
9513
  Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
9514
+ A_bigint_literal_cannot_be_used_as_a_property_name: diag(1539, 1 /* Error */, "A_bigint_literal_cannot_be_used_as_a_property_name_1539", "A 'bigint' literal cannot be used as a property name."),
9513
9515
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
9514
9516
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
9515
9517
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -10751,9 +10753,11 @@ var Diagnostics = {
10751
10753
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
10752
10754
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
10753
10755
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
10756
+ Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
10754
10757
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
10755
10758
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
10756
10759
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
10760
+ Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
10757
10761
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
10758
10762
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
10759
10763
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -17216,6 +17220,7 @@ function tryGetTextOfPropertyName(name) {
17216
17220
  return ((_a = name.emitNode) == null ? void 0 : _a.autoGenerate) ? void 0 : name.escapedText;
17217
17221
  case 11 /* StringLiteral */:
17218
17222
  case 9 /* NumericLiteral */:
17223
+ case 10 /* BigIntLiteral */:
17219
17224
  case 15 /* NoSubstitutionTemplateLiteral */:
17220
17225
  return escapeLeadingUnderscores(name.text);
17221
17226
  case 167 /* ComputedPropertyName */:
@@ -19263,6 +19268,7 @@ function getPropertyNameForPropertyNameNode(name) {
19263
19268
  case 11 /* StringLiteral */:
19264
19269
  case 15 /* NoSubstitutionTemplateLiteral */:
19265
19270
  case 9 /* NumericLiteral */:
19271
+ case 10 /* BigIntLiteral */:
19266
19272
  return escapeLeadingUnderscores(name.text);
19267
19273
  case 167 /* ComputedPropertyName */:
19268
19274
  const nameExpression = name.expression;
@@ -21748,6 +21754,12 @@ var computedOptions = createComputedCompilerOptions({
21748
21754
  return getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
21749
21755
  }
21750
21756
  },
21757
+ strictBuiltinIteratorReturn: {
21758
+ dependencies: ["strict"],
21759
+ computeValue: (compilerOptions) => {
21760
+ return getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
21761
+ }
21762
+ },
21751
21763
  alwaysStrict: {
21752
21764
  dependencies: ["strict"],
21753
21765
  computeValue: (compilerOptions) => {
@@ -23559,6 +23571,10 @@ function hasInferredType(node) {
23559
23571
  return false;
23560
23572
  }
23561
23573
  }
23574
+ function isSideEffectImport(node) {
23575
+ const ancestor = findAncestor(node, isImportDeclaration);
23576
+ return !!ancestor && !ancestor.importClause;
23577
+ }
23562
23578
 
23563
23579
  // src/compiler/factory/baseNodeFactory.ts
23564
23580
  function createBaseNodeFactory() {
@@ -33314,13 +33330,13 @@ var Parser;
33314
33330
  return createIdentifier(tokenIsIdentifierOrKeyword(token()));
33315
33331
  }
33316
33332
  function isLiteralPropertyName() {
33317
- return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
33333
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */;
33318
33334
  }
33319
33335
  function isImportAttributeName2() {
33320
33336
  return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
33321
33337
  }
33322
33338
  function parsePropertyNameWorker(allowComputedPropertyNames) {
33323
- if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */) {
33339
+ if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */) {
33324
33340
  const node = parseLiteralNode();
33325
33341
  node.text = internIdentifier(node.text);
33326
33342
  return node;
@@ -37547,7 +37563,7 @@ var Parser;
37547
37563
  if (isIndexSignature()) {
37548
37564
  return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers);
37549
37565
  }
37550
- if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
37566
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
37551
37567
  const isAmbient = some(modifiers, isDeclareModifier);
37552
37568
  if (isAmbient) {
37553
37569
  for (const m of modifiers) {
@@ -39863,6 +39879,7 @@ var libEntries = [
39863
39879
  ["esnext.array", "lib.esnext.array.d.ts"],
39864
39880
  ["esnext.regexp", "lib.esnext.regexp.d.ts"],
39865
39881
  ["esnext.string", "lib.esnext.string.d.ts"],
39882
+ ["esnext.iterator", "lib.esnext.iterator.d.ts"],
39866
39883
  ["decorators", "lib.decorators.d.ts"],
39867
39884
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
39868
39885
  ];
@@ -40514,6 +40531,16 @@ var commandOptionsWithoutBuild = [
40514
40531
  description: Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
40515
40532
  defaultValueDescription: Diagnostics.false_unless_strict_is_set
40516
40533
  },
40534
+ {
40535
+ name: "strictBuiltinIteratorReturn",
40536
+ type: "boolean",
40537
+ affectsSemanticDiagnostics: true,
40538
+ affectsBuildInfo: true,
40539
+ strictFlag: true,
40540
+ category: Diagnostics.Type_Checking,
40541
+ description: Diagnostics.Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any,
40542
+ defaultValueDescription: Diagnostics.false_unless_strict_is_set
40543
+ },
40517
40544
  {
40518
40545
  name: "noImplicitThis",
40519
40546
  type: "boolean",
@@ -40789,6 +40816,15 @@ var commandOptionsWithoutBuild = [
40789
40816
  category: Diagnostics.Modules,
40790
40817
  description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports
40791
40818
  },
40819
+ {
40820
+ name: "noUncheckedSideEffectImports",
40821
+ type: "boolean",
40822
+ affectsSemanticDiagnostics: true,
40823
+ affectsBuildInfo: true,
40824
+ category: Diagnostics.Modules,
40825
+ description: Diagnostics.Check_side_effect_imports,
40826
+ defaultValueDescription: false
40827
+ },
40792
40828
  // Source Maps
40793
40829
  {
40794
40830
  name: "sourceRoot",
@@ -49890,10 +49926,12 @@ function createTypeChecker(host) {
49890
49926
  var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
49891
49927
  var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
49892
49928
  var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
49929
+ var strictBuiltinIteratorReturn = getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
49893
49930
  var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
49894
49931
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
49895
49932
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
49896
49933
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
49934
+ var noUncheckedSideEffectImports = !!compilerOptions.noUncheckedSideEffectImports;
49897
49935
  var checkBinaryExpression = createCheckBinaryExpression();
49898
49936
  var emitResolver = createResolver();
49899
49937
  var nodeBuilder = createNodeBuilder();
@@ -50222,13 +50260,13 @@ function createTypeChecker(host) {
50222
50260
  /*reportErrors*/
50223
50261
  false
50224
50262
  ),
50225
- getAsyncIterableType: () => {
50263
+ getAnyAsyncIterableType: () => {
50226
50264
  const type = getGlobalAsyncIterableType(
50227
50265
  /*reportErrors*/
50228
50266
  false
50229
50267
  );
50230
50268
  if (type === emptyGenericType) return void 0;
50231
- return type;
50269
+ return createTypeReference(type, [anyType, anyType, anyType]);
50232
50270
  },
50233
50271
  isSymbolAccessible,
50234
50272
  isArrayType,
@@ -50700,8 +50738,6 @@ function createTypeChecker(host) {
50700
50738
  }
50701
50739
  };
50702
50740
  var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
50703
- var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
50704
- var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
50705
50741
  var asyncIterationTypesResolver = {
50706
50742
  iterableCacheKey: "iterationTypesOfAsyncIterable",
50707
50743
  iteratorCacheKey: "iterationTypesOfAsyncIterator",
@@ -50709,6 +50745,7 @@ function createTypeChecker(host) {
50709
50745
  getGlobalIteratorType: getGlobalAsyncIteratorType,
50710
50746
  getGlobalIterableType: getGlobalAsyncIterableType,
50711
50747
  getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
50748
+ getGlobalBuiltinIteratorType: getGlobalAsyncBuiltinIteratorType,
50712
50749
  getGlobalGeneratorType: getGlobalAsyncGeneratorType,
50713
50750
  resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member),
50714
50751
  mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
@@ -50722,6 +50759,7 @@ function createTypeChecker(host) {
50722
50759
  getGlobalIteratorType,
50723
50760
  getGlobalIterableType,
50724
50761
  getGlobalIterableIteratorType,
50762
+ getGlobalBuiltinIteratorType,
50725
50763
  getGlobalGeneratorType,
50726
50764
  resolveIterationType: (type, _errorNode) => type,
50727
50765
  mustHaveANextMethodDiagnostic: Diagnostics.An_iterator_must_have_a_next_method,
@@ -50760,12 +50798,14 @@ function createTypeChecker(host) {
50760
50798
  var deferredGlobalIterableType;
50761
50799
  var deferredGlobalIteratorType;
50762
50800
  var deferredGlobalIterableIteratorType;
50801
+ var deferredGlobalBuiltinIteratorType;
50763
50802
  var deferredGlobalGeneratorType;
50764
50803
  var deferredGlobalIteratorYieldResultType;
50765
50804
  var deferredGlobalIteratorReturnResultType;
50766
50805
  var deferredGlobalAsyncIterableType;
50767
50806
  var deferredGlobalAsyncIteratorType;
50768
50807
  var deferredGlobalAsyncIterableIteratorType;
50808
+ var deferredGlobalAsyncBuiltinIteratorType;
50769
50809
  var deferredGlobalAsyncGeneratorType;
50770
50810
  var deferredGlobalTemplateStringsArrayType;
50771
50811
  var deferredGlobalImportMetaType;
@@ -52878,7 +52918,7 @@ function createTypeChecker(host) {
52878
52918
  }
52879
52919
  return getMergedSymbol(sourceFile.symbol);
52880
52920
  }
52881
- if (errorNode && moduleNotFoundError) {
52921
+ if (errorNode && moduleNotFoundError && !isSideEffectImport(errorNode)) {
52882
52922
  error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
52883
52923
  }
52884
52924
  return void 0;
@@ -52963,6 +53003,9 @@ function createTypeChecker(host) {
52963
53003
  }
52964
53004
  }
52965
53005
  function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
53006
+ if (isSideEffectImport(errorNode)) {
53007
+ return;
53008
+ }
52966
53009
  let errorInfo;
52967
53010
  if (!isExternalModuleNameRelative(moduleReference) && packageId) {
52968
53011
  errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
@@ -54791,7 +54834,35 @@ function createTypeChecker(host) {
54791
54834
  }
54792
54835
  let typeArgumentNodes;
54793
54836
  if (typeArguments.length > 0) {
54794
- const typeParameterCount = (type2.target.typeParameters || emptyArray).length;
54837
+ let typeParameterCount = 0;
54838
+ if (type2.target.typeParameters) {
54839
+ typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
54840
+ if (isReferenceToType2(type2, getGlobalIterableType(
54841
+ /*reportErrors*/
54842
+ false
54843
+ )) || isReferenceToType2(type2, getGlobalIterableIteratorType(
54844
+ /*reportErrors*/
54845
+ false
54846
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableType(
54847
+ /*reportErrors*/
54848
+ false
54849
+ )) || isReferenceToType2(type2, getGlobalAsyncIterableIteratorType(
54850
+ /*reportErrors*/
54851
+ false
54852
+ ))) {
54853
+ if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
54854
+ while (typeParameterCount > 0) {
54855
+ const typeArgument = typeArguments[typeParameterCount - 1];
54856
+ const typeParameter = type2.target.typeParameters[typeParameterCount - 1];
54857
+ const defaultType = getDefaultFromTypeParameter(typeParameter);
54858
+ if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
54859
+ break;
54860
+ }
54861
+ typeParameterCount--;
54862
+ }
54863
+ }
54864
+ }
54865
+ }
54795
54866
  typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
54796
54867
  }
54797
54868
  const flags = context.flags;
@@ -60236,6 +60307,9 @@ function createTypeChecker(host) {
60236
60307
  links.instantiations = /* @__PURE__ */ new Map();
60237
60308
  links.instantiations.set(getTypeListId(typeParameters), type);
60238
60309
  }
60310
+ if (type === intrinsicMarkerType && symbol.escapedName === "BuiltinIteratorReturn") {
60311
+ type = strictBuiltinIteratorReturn ? undefinedType : anyType;
60312
+ }
60239
60313
  } else {
60240
60314
  type = errorType;
60241
60315
  if (declaration.kind === 340 /* JSDocEnumTag */) {
@@ -63513,7 +63587,7 @@ function createTypeChecker(host) {
63513
63587
  return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
63514
63588
  "AsyncIterable",
63515
63589
  /*arity*/
63516
- 1,
63590
+ 3,
63517
63591
  reportErrors2
63518
63592
  )) || emptyGenericType;
63519
63593
  }
@@ -63529,7 +63603,15 @@ function createTypeChecker(host) {
63529
63603
  return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
63530
63604
  "AsyncIterableIterator",
63531
63605
  /*arity*/
63532
- 1,
63606
+ 3,
63607
+ reportErrors2
63608
+ )) || emptyGenericType;
63609
+ }
63610
+ function getGlobalAsyncBuiltinIteratorType(reportErrors2) {
63611
+ return deferredGlobalAsyncBuiltinIteratorType || (deferredGlobalAsyncBuiltinIteratorType = getGlobalType(
63612
+ "AsyncBuiltinIterator",
63613
+ /*arity*/
63614
+ 3,
63533
63615
  reportErrors2
63534
63616
  )) || emptyGenericType;
63535
63617
  }
@@ -63545,7 +63627,7 @@ function createTypeChecker(host) {
63545
63627
  return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
63546
63628
  "Iterable",
63547
63629
  /*arity*/
63548
- 1,
63630
+ 3,
63549
63631
  reportErrors2
63550
63632
  )) || emptyGenericType;
63551
63633
  }
@@ -63561,7 +63643,15 @@ function createTypeChecker(host) {
63561
63643
  return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
63562
63644
  "IterableIterator",
63563
63645
  /*arity*/
63564
- 1,
63646
+ 3,
63647
+ reportErrors2
63648
+ )) || emptyGenericType;
63649
+ }
63650
+ function getGlobalBuiltinIteratorType(reportErrors2) {
63651
+ return deferredGlobalBuiltinIteratorType || (deferredGlobalBuiltinIteratorType = getGlobalType(
63652
+ "BuiltinIterator",
63653
+ /*arity*/
63654
+ 3,
63565
63655
  reportErrors2
63566
63656
  )) || emptyGenericType;
63567
63657
  }
@@ -63743,7 +63833,7 @@ function createTypeChecker(host) {
63743
63833
  return createTypeFromGenericGlobalType(getGlobalIterableType(
63744
63834
  /*reportErrors*/
63745
63835
  true
63746
- ), [iteratedType]);
63836
+ ), [iteratedType, voidType, undefinedType]);
63747
63837
  }
63748
63838
  function createArrayType(elementType, readonly) {
63749
63839
  return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
@@ -65103,12 +65193,13 @@ function createTypeChecker(host) {
65103
65193
  }
65104
65194
  if (accessNode) {
65105
65195
  const indexNode = getIndexNodeForAccessExpression(accessNode);
65106
- if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
65196
+ if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
65107
65197
  error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
65108
65198
  } else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
65109
65199
  error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
65110
65200
  } else {
65111
- error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
65201
+ const typeString = indexNode.kind === 10 /* BigIntLiteral */ ? "bigint" : typeToString(indexType);
65202
+ error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeString);
65112
65203
  }
65113
65204
  }
65114
65205
  if (isTypeAny(indexType)) {
@@ -81218,24 +81309,14 @@ function createTypeChecker(host) {
81218
81309
  void 0
81219
81310
  ) || unknownType;
81220
81311
  if (globalGeneratorType === emptyGenericType) {
81221
- const globalType = resolver.getGlobalIterableIteratorType(
81312
+ const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
81222
81313
  /*reportErrors*/
81223
81314
  false
81224
81315
  );
81225
- const iterationTypes = globalType !== emptyGenericType ? getIterationTypesOfGlobalIterableType(globalType, resolver) : void 0;
81226
- const iterableIteratorReturnType = iterationTypes ? iterationTypes.returnType : anyType;
81227
- const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
81228
- if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
81229
- if (globalType !== emptyGenericType) {
81230
- return createTypeFromGenericGlobalType(globalType, [yieldType]);
81231
- }
81232
- resolver.getGlobalIterableIteratorType(
81233
- /*reportErrors*/
81234
- true
81235
- );
81236
- return emptyObjectType;
81316
+ if (globalIterableIteratorType !== emptyGenericType) {
81317
+ return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
81237
81318
  }
81238
- resolver.getGlobalGeneratorType(
81319
+ resolver.getGlobalIterableIteratorType(
81239
81320
  /*reportErrors*/
81240
81321
  true
81241
81322
  );
@@ -85675,6 +85756,9 @@ function createTypeChecker(host) {
85675
85756
  checkAliasSymbol(node);
85676
85757
  return;
85677
85758
  }
85759
+ if (node.name.kind === 10 /* BigIntLiteral */) {
85760
+ error2(node.name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name);
85761
+ }
85678
85762
  const type = convertAutoToAny(getTypeOfSymbol(symbol));
85679
85763
  if (node === symbol.valueDeclaration) {
85680
85764
  const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
@@ -86309,41 +86393,17 @@ function createTypeChecker(host) {
86309
86393
  function getIterationTypesOfIterableCached(type, resolver) {
86310
86394
  return getCachedIterationTypes(type, resolver.iterableCacheKey);
86311
86395
  }
86312
- function getIterationTypesOfGlobalIterableType(globalType, resolver) {
86313
- const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
86314
- globalType,
86315
- resolver,
86316
- /*errorNode*/
86317
- void 0,
86318
- /*errorOutputContainer*/
86319
- void 0,
86320
- /*noCache*/
86321
- false
86322
- );
86323
- return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
86324
- }
86325
86396
  function getIterationTypesOfIterableFast(type, resolver) {
86326
- let globalType;
86327
- if (isReferenceToType2(type, globalType = resolver.getGlobalIterableType(
86397
+ if (isReferenceToType2(type, resolver.getGlobalIterableType(
86328
86398
  /*reportErrors*/
86329
86399
  false
86330
- )) || isReferenceToType2(type, globalType = resolver.getGlobalIterableIteratorType(
86400
+ )) || isReferenceToType2(type, resolver.getGlobalBuiltinIteratorType(
86331
86401
  /*reportErrors*/
86332
86402
  false
86333
- ))) {
86334
- const [yieldType] = getTypeArguments(type);
86335
- const { returnType, nextType } = getIterationTypesOfGlobalIterableType(globalType, resolver);
86336
- return setCachedIterationTypes(type, resolver.iterableCacheKey, createIterationTypes(resolver.resolveIterationType(
86337
- yieldType,
86338
- /*errorNode*/
86339
- void 0
86340
- ) || yieldType, resolver.resolveIterationType(
86341
- returnType,
86342
- /*errorNode*/
86343
- void 0
86344
- ) || returnType, nextType));
86345
- }
86346
- if (isReferenceToType2(type, resolver.getGlobalGeneratorType(
86403
+ )) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
86404
+ /*reportErrors*/
86405
+ false
86406
+ )) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
86347
86407
  /*reportErrors*/
86348
86408
  false
86349
86409
  ))) {
@@ -86388,10 +86448,10 @@ function createTypeChecker(host) {
86388
86448
  !!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
86389
86449
  /*reportErrors*/
86390
86450
  false
86391
- ) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
86451
+ ) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
86392
86452
  /*reportErrors*/
86393
86453
  false
86394
- ))
86454
+ ), [anyType, anyType, anyType]))
86395
86455
  );
86396
86456
  return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
86397
86457
  }
@@ -86421,26 +86481,13 @@ function createTypeChecker(host) {
86421
86481
  return getCachedIterationTypes(type, resolver.iteratorCacheKey);
86422
86482
  }
86423
86483
  function getIterationTypesOfIteratorFast(type, resolver) {
86424
- const globalType = resolver.getGlobalIterableIteratorType(
86484
+ if (isReferenceToType2(type, resolver.getGlobalBuiltinIteratorType(
86425
86485
  /*reportErrors*/
86426
86486
  false
86427
- );
86428
- if (isReferenceToType2(type, globalType)) {
86429
- const [yieldType] = getTypeArguments(type);
86430
- const globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) || getIterationTypesOfIteratorSlow(
86431
- globalType,
86432
- resolver,
86433
- /*errorNode*/
86434
- void 0,
86435
- /*errorOutputContainer*/
86436
- void 0,
86437
- /*noCache*/
86438
- false
86439
- );
86440
- const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
86441
- return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
86442
- }
86443
- if (isReferenceToType2(type, resolver.getGlobalIteratorType(
86487
+ )) || isReferenceToType2(type, resolver.getGlobalIterableIteratorType(
86488
+ /*reportErrors*/
86489
+ false
86490
+ )) || isReferenceToType2(type, resolver.getGlobalIteratorType(
86444
86491
  /*reportErrors*/
86445
86492
  false
86446
86493
  )) || isReferenceToType2(type, resolver.getGlobalGeneratorType(
@@ -86517,7 +86564,7 @@ function createTypeChecker(host) {
86517
86564
  }
86518
86565
  const methodType = method && !(methodName === "next" && method.flags & 16777216 /* Optional */) ? methodName === "next" ? getTypeOfSymbol(method) : getTypeWithFacts(getTypeOfSymbol(method), 2097152 /* NEUndefinedOrNull */) : void 0;
86519
86566
  if (isTypeAny(methodType)) {
86520
- return methodName === "next" ? anyIterationTypes : anyIterationTypesExceptNext;
86567
+ return anyIterationTypes;
86521
86568
  }
86522
86569
  const methodSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : emptyArray;
86523
86570
  if (methodSignatures.length === 0) {
@@ -87655,7 +87702,9 @@ function createTypeChecker(host) {
87655
87702
  checkExportsOnMergedDeclarations(node);
87656
87703
  checkTypeParameters(node.typeParameters);
87657
87704
  if (node.type.kind === 141 /* IntrinsicKeyword */) {
87658
- if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
87705
+ const typeParameterCount = length(node.typeParameters);
87706
+ const valid = typeParameterCount === 0 ? node.name.escapedText === "BuiltinIteratorReturn" : typeParameterCount === 1 && intrinsicTypeKinds.has(node.name.escapedText);
87707
+ if (!valid) {
87659
87708
  error2(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
87660
87709
  }
87661
87710
  } else {
@@ -88295,6 +88344,8 @@ function createTypeChecker(host) {
88295
88344
  }
88296
88345
  }
88297
88346
  }
88347
+ } else if (noUncheckedSideEffectImports && !importClause) {
88348
+ void resolveExternalModuleName(node, node.moduleSpecifier);
88298
88349
  }
88299
88350
  }
88300
88351
  checkImportAttributes(node);
@@ -91572,6 +91623,13 @@ function createTypeChecker(host) {
91572
91623
  if (name.kind === 9 /* NumericLiteral */) {
91573
91624
  checkGrammarNumericLiteral(name);
91574
91625
  }
91626
+ if (name.kind === 10 /* BigIntLiteral */) {
91627
+ addErrorOrSuggestion(
91628
+ /*isError*/
91629
+ true,
91630
+ createDiagnosticForNode(name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name)
91631
+ );
91632
+ }
91575
91633
  currentKind = 4 /* PropertyAssignment */;
91576
91634
  break;
91577
91635
  case 174 /* MethodDeclaration */:
@@ -95306,7 +95364,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
95306
95364
  propertyName
95307
95365
  );
95308
95366
  return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
95309
- } else if (isStringOrNumericLiteralLike(propertyName)) {
95367
+ } else if (isStringOrNumericLiteralLike(propertyName) || isBigIntLiteral(propertyName)) {
95310
95368
  const argumentExpression = factory2.cloneNode(propertyName);
95311
95369
  return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
95312
95370
  } else {
@@ -151960,7 +152018,7 @@ function isInsideAwaitableBody(node) {
151960
152018
  function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) {
151961
152019
  if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) {
151962
152020
  const exprType = checker.getTypeAtLocation(insertionSite);
151963
- const asyncIter = checker.getAsyncIterableType();
152021
+ const asyncIter = checker.getAnyAsyncIterableType();
151964
152022
  if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) {
151965
152023
  const forOf = insertionSite.parent;
151966
152024
  changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement));
@@ -180354,6 +180412,7 @@ __export(ts_exports2, {
180354
180412
  isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
180355
180413
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
180356
180414
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
180415
+ isSideEffectImport: () => isSideEffectImport,
180357
180416
  isSignedNumericLiteral: () => isSignedNumericLiteral,
180358
180417
  isSimpleCopiableExpression: () => isSimpleCopiableExpression,
180359
180418
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
@@ -194718,6 +194777,7 @@ if (typeof console !== "undefined") {
194718
194777
  isShiftOperatorOrHigher,
194719
194778
  isShorthandAmbientModuleSymbol,
194720
194779
  isShorthandPropertyAssignment,
194780
+ isSideEffectImport,
194721
194781
  isSignedNumericLiteral,
194722
194782
  isSimpleCopiableExpression,
194723
194783
  isSimpleInlineableExpression,
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.6.0-dev.20240719",
5
+ "version": "5.6.0-dev.20240720",
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": "f8a7913c1e67cc7262c49b144a90b9d577a16fef"
117
+ "gitHead": "903e82b368c8328dba95b70b21415e7a48339857"
118
118
  }