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/lib.dom.asynciterable.d.ts +6 -6
- package/lib/lib.dom.iterable.d.ts +73 -73
- package/lib/lib.es2015.generator.d.ts +2 -2
- package/lib/lib.es2015.iterable.d.ts +74 -68
- package/lib/lib.es2018.asyncgenerator.d.ts +2 -2
- package/lib/lib.es2018.asynciterable.d.ts +10 -6
- package/lib/lib.es2020.bigint.d.ts +8 -8
- package/lib/lib.es2020.string.d.ts +1 -1
- package/lib/lib.es2020.symbol.wellknown.d.ts +1 -1
- package/lib/lib.es2022.intl.d.ts +1 -1
- package/lib/lib.esnext.d.ts +1 -0
- package/lib/lib.esnext.iterator.d.ts +148 -0
- package/lib/lib.webworker.asynciterable.d.ts +6 -6
- package/lib/lib.webworker.iterable.d.ts +30 -30
- package/lib/tsc.js +141 -84
- package/lib/typescript.d.ts +4 -2
- package/lib/typescript.js +145 -85
- package/package.json +2 -2
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.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240720`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6124,6 +6124,7 @@ var Diagnostics = {
|
|
|
6124
6124
|
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."),
|
|
6125
6125
|
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."),
|
|
6126
6126
|
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."),
|
|
6127
|
+
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."),
|
|
6127
6128
|
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."),
|
|
6128
6129
|
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."),
|
|
6129
6130
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -7365,9 +7366,11 @@ var Diagnostics = {
|
|
|
7365
7366
|
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."),
|
|
7366
7367
|
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."),
|
|
7367
7368
|
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."),
|
|
7369
|
+
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'."),
|
|
7368
7370
|
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'."),
|
|
7369
7371
|
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."),
|
|
7370
7372
|
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)."),
|
|
7373
|
+
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
|
7371
7374
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7372
7375
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7373
7376
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -13532,6 +13535,7 @@ function tryGetTextOfPropertyName(name) {
|
|
|
13532
13535
|
return ((_a = name.emitNode) == null ? void 0 : _a.autoGenerate) ? void 0 : name.escapedText;
|
|
13533
13536
|
case 11 /* StringLiteral */:
|
|
13534
13537
|
case 9 /* NumericLiteral */:
|
|
13538
|
+
case 10 /* BigIntLiteral */:
|
|
13535
13539
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
13536
13540
|
return escapeLeadingUnderscores(name.text);
|
|
13537
13541
|
case 167 /* ComputedPropertyName */:
|
|
@@ -15496,6 +15500,7 @@ function getPropertyNameForPropertyNameNode(name) {
|
|
|
15496
15500
|
case 11 /* StringLiteral */:
|
|
15497
15501
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
15498
15502
|
case 9 /* NumericLiteral */:
|
|
15503
|
+
case 10 /* BigIntLiteral */:
|
|
15499
15504
|
return escapeLeadingUnderscores(name.text);
|
|
15500
15505
|
case 167 /* ComputedPropertyName */:
|
|
15501
15506
|
const nameExpression = name.expression;
|
|
@@ -17795,6 +17800,12 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
17795
17800
|
return getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
|
|
17796
17801
|
}
|
|
17797
17802
|
},
|
|
17803
|
+
strictBuiltinIteratorReturn: {
|
|
17804
|
+
dependencies: ["strict"],
|
|
17805
|
+
computeValue: (compilerOptions) => {
|
|
17806
|
+
return getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
|
|
17807
|
+
}
|
|
17808
|
+
},
|
|
17798
17809
|
alwaysStrict: {
|
|
17799
17810
|
dependencies: ["strict"],
|
|
17800
17811
|
computeValue: (compilerOptions) => {
|
|
@@ -19467,6 +19478,10 @@ function hasInferredType(node) {
|
|
|
19467
19478
|
return false;
|
|
19468
19479
|
}
|
|
19469
19480
|
}
|
|
19481
|
+
function isSideEffectImport(node) {
|
|
19482
|
+
const ancestor = findAncestor(node, isImportDeclaration);
|
|
19483
|
+
return !!ancestor && !ancestor.importClause;
|
|
19484
|
+
}
|
|
19470
19485
|
|
|
19471
19486
|
// src/compiler/factory/baseNodeFactory.ts
|
|
19472
19487
|
function createBaseNodeFactory() {
|
|
@@ -29055,13 +29070,13 @@ var Parser;
|
|
|
29055
29070
|
return createIdentifier(tokenIsIdentifierOrKeyword(token()));
|
|
29056
29071
|
}
|
|
29057
29072
|
function isLiteralPropertyName() {
|
|
29058
|
-
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
|
|
29073
|
+
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */;
|
|
29059
29074
|
}
|
|
29060
29075
|
function isImportAttributeName2() {
|
|
29061
29076
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
|
|
29062
29077
|
}
|
|
29063
29078
|
function parsePropertyNameWorker(allowComputedPropertyNames) {
|
|
29064
|
-
if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */) {
|
|
29079
|
+
if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */) {
|
|
29065
29080
|
const node = parseLiteralNode();
|
|
29066
29081
|
node.text = internIdentifier(node.text);
|
|
29067
29082
|
return node;
|
|
@@ -33288,7 +33303,7 @@ var Parser;
|
|
|
33288
33303
|
if (isIndexSignature()) {
|
|
33289
33304
|
return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers);
|
|
33290
33305
|
}
|
|
33291
|
-
if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
|
|
33306
|
+
if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) {
|
|
33292
33307
|
const isAmbient = some(modifiers, isDeclareModifier);
|
|
33293
33308
|
if (isAmbient) {
|
|
33294
33309
|
for (const m of modifiers) {
|
|
@@ -35604,6 +35619,7 @@ var libEntries = [
|
|
|
35604
35619
|
["esnext.array", "lib.esnext.array.d.ts"],
|
|
35605
35620
|
["esnext.regexp", "lib.esnext.regexp.d.ts"],
|
|
35606
35621
|
["esnext.string", "lib.esnext.string.d.ts"],
|
|
35622
|
+
["esnext.iterator", "lib.esnext.iterator.d.ts"],
|
|
35607
35623
|
["decorators", "lib.decorators.d.ts"],
|
|
35608
35624
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
35609
35625
|
];
|
|
@@ -36255,6 +36271,16 @@ var commandOptionsWithoutBuild = [
|
|
|
36255
36271
|
description: Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
|
|
36256
36272
|
defaultValueDescription: Diagnostics.false_unless_strict_is_set
|
|
36257
36273
|
},
|
|
36274
|
+
{
|
|
36275
|
+
name: "strictBuiltinIteratorReturn",
|
|
36276
|
+
type: "boolean",
|
|
36277
|
+
affectsSemanticDiagnostics: true,
|
|
36278
|
+
affectsBuildInfo: true,
|
|
36279
|
+
strictFlag: true,
|
|
36280
|
+
category: Diagnostics.Type_Checking,
|
|
36281
|
+
description: Diagnostics.Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any,
|
|
36282
|
+
defaultValueDescription: Diagnostics.false_unless_strict_is_set
|
|
36283
|
+
},
|
|
36258
36284
|
{
|
|
36259
36285
|
name: "noImplicitThis",
|
|
36260
36286
|
type: "boolean",
|
|
@@ -36530,6 +36556,15 @@ var commandOptionsWithoutBuild = [
|
|
|
36530
36556
|
category: Diagnostics.Modules,
|
|
36531
36557
|
description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports
|
|
36532
36558
|
},
|
|
36559
|
+
{
|
|
36560
|
+
name: "noUncheckedSideEffectImports",
|
|
36561
|
+
type: "boolean",
|
|
36562
|
+
affectsSemanticDiagnostics: true,
|
|
36563
|
+
affectsBuildInfo: true,
|
|
36564
|
+
category: Diagnostics.Modules,
|
|
36565
|
+
description: Diagnostics.Check_side_effect_imports,
|
|
36566
|
+
defaultValueDescription: false
|
|
36567
|
+
},
|
|
36533
36568
|
// Source Maps
|
|
36534
36569
|
{
|
|
36535
36570
|
name: "sourceRoot",
|
|
@@ -45282,10 +45317,12 @@ function createTypeChecker(host) {
|
|
|
45282
45317
|
var strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
|
|
45283
45318
|
var strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply");
|
|
45284
45319
|
var strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
|
|
45320
|
+
var strictBuiltinIteratorReturn = getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn");
|
|
45285
45321
|
var noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
|
|
45286
45322
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
45287
45323
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
45288
45324
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
45325
|
+
var noUncheckedSideEffectImports = !!compilerOptions.noUncheckedSideEffectImports;
|
|
45289
45326
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
45290
45327
|
var emitResolver = createResolver();
|
|
45291
45328
|
var nodeBuilder = createNodeBuilder();
|
|
@@ -45614,13 +45651,13 @@ function createTypeChecker(host) {
|
|
|
45614
45651
|
/*reportErrors*/
|
|
45615
45652
|
false
|
|
45616
45653
|
),
|
|
45617
|
-
|
|
45654
|
+
getAnyAsyncIterableType: () => {
|
|
45618
45655
|
const type = getGlobalAsyncIterableType(
|
|
45619
45656
|
/*reportErrors*/
|
|
45620
45657
|
false
|
|
45621
45658
|
);
|
|
45622
45659
|
if (type === emptyGenericType) return void 0;
|
|
45623
|
-
return type;
|
|
45660
|
+
return createTypeReference(type, [anyType, anyType, anyType]);
|
|
45624
45661
|
},
|
|
45625
45662
|
isSymbolAccessible,
|
|
45626
45663
|
isArrayType,
|
|
@@ -46092,8 +46129,6 @@ function createTypeChecker(host) {
|
|
|
46092
46129
|
}
|
|
46093
46130
|
};
|
|
46094
46131
|
var anyIterationTypes = createIterationTypes(anyType, anyType, anyType);
|
|
46095
|
-
var anyIterationTypesExceptNext = createIterationTypes(anyType, anyType, unknownType);
|
|
46096
|
-
var defaultIterationTypes = createIterationTypes(neverType, anyType, undefinedType);
|
|
46097
46132
|
var asyncIterationTypesResolver = {
|
|
46098
46133
|
iterableCacheKey: "iterationTypesOfAsyncIterable",
|
|
46099
46134
|
iteratorCacheKey: "iterationTypesOfAsyncIterator",
|
|
@@ -46101,6 +46136,7 @@ function createTypeChecker(host) {
|
|
|
46101
46136
|
getGlobalIteratorType: getGlobalAsyncIteratorType,
|
|
46102
46137
|
getGlobalIterableType: getGlobalAsyncIterableType,
|
|
46103
46138
|
getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType,
|
|
46139
|
+
getGlobalBuiltinIteratorType: getGlobalAsyncBuiltinIteratorType,
|
|
46104
46140
|
getGlobalGeneratorType: getGlobalAsyncGeneratorType,
|
|
46105
46141
|
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),
|
|
46106
46142
|
mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method,
|
|
@@ -46114,6 +46150,7 @@ function createTypeChecker(host) {
|
|
|
46114
46150
|
getGlobalIteratorType,
|
|
46115
46151
|
getGlobalIterableType,
|
|
46116
46152
|
getGlobalIterableIteratorType,
|
|
46153
|
+
getGlobalBuiltinIteratorType,
|
|
46117
46154
|
getGlobalGeneratorType,
|
|
46118
46155
|
resolveIterationType: (type, _errorNode) => type,
|
|
46119
46156
|
mustHaveANextMethodDiagnostic: Diagnostics.An_iterator_must_have_a_next_method,
|
|
@@ -46152,12 +46189,14 @@ function createTypeChecker(host) {
|
|
|
46152
46189
|
var deferredGlobalIterableType;
|
|
46153
46190
|
var deferredGlobalIteratorType;
|
|
46154
46191
|
var deferredGlobalIterableIteratorType;
|
|
46192
|
+
var deferredGlobalBuiltinIteratorType;
|
|
46155
46193
|
var deferredGlobalGeneratorType;
|
|
46156
46194
|
var deferredGlobalIteratorYieldResultType;
|
|
46157
46195
|
var deferredGlobalIteratorReturnResultType;
|
|
46158
46196
|
var deferredGlobalAsyncIterableType;
|
|
46159
46197
|
var deferredGlobalAsyncIteratorType;
|
|
46160
46198
|
var deferredGlobalAsyncIterableIteratorType;
|
|
46199
|
+
var deferredGlobalAsyncBuiltinIteratorType;
|
|
46161
46200
|
var deferredGlobalAsyncGeneratorType;
|
|
46162
46201
|
var deferredGlobalTemplateStringsArrayType;
|
|
46163
46202
|
var deferredGlobalImportMetaType;
|
|
@@ -48270,7 +48309,7 @@ function createTypeChecker(host) {
|
|
|
48270
48309
|
}
|
|
48271
48310
|
return getMergedSymbol(sourceFile.symbol);
|
|
48272
48311
|
}
|
|
48273
|
-
if (errorNode && moduleNotFoundError) {
|
|
48312
|
+
if (errorNode && moduleNotFoundError && !isSideEffectImport(errorNode)) {
|
|
48274
48313
|
error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
48275
48314
|
}
|
|
48276
48315
|
return void 0;
|
|
@@ -48355,6 +48394,9 @@ function createTypeChecker(host) {
|
|
|
48355
48394
|
}
|
|
48356
48395
|
}
|
|
48357
48396
|
function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
|
|
48397
|
+
if (isSideEffectImport(errorNode)) {
|
|
48398
|
+
return;
|
|
48399
|
+
}
|
|
48358
48400
|
let errorInfo;
|
|
48359
48401
|
if (!isExternalModuleNameRelative(moduleReference) && packageId) {
|
|
48360
48402
|
errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
|
|
@@ -50183,7 +50225,35 @@ function createTypeChecker(host) {
|
|
|
50183
50225
|
}
|
|
50184
50226
|
let typeArgumentNodes;
|
|
50185
50227
|
if (typeArguments.length > 0) {
|
|
50186
|
-
|
|
50228
|
+
let typeParameterCount = 0;
|
|
50229
|
+
if (type2.target.typeParameters) {
|
|
50230
|
+
typeParameterCount = Math.min(type2.target.typeParameters.length, typeArguments.length);
|
|
50231
|
+
if (isReferenceToType(type2, getGlobalIterableType(
|
|
50232
|
+
/*reportErrors*/
|
|
50233
|
+
false
|
|
50234
|
+
)) || isReferenceToType(type2, getGlobalIterableIteratorType(
|
|
50235
|
+
/*reportErrors*/
|
|
50236
|
+
false
|
|
50237
|
+
)) || isReferenceToType(type2, getGlobalAsyncIterableType(
|
|
50238
|
+
/*reportErrors*/
|
|
50239
|
+
false
|
|
50240
|
+
)) || isReferenceToType(type2, getGlobalAsyncIterableIteratorType(
|
|
50241
|
+
/*reportErrors*/
|
|
50242
|
+
false
|
|
50243
|
+
))) {
|
|
50244
|
+
if (!type2.node || !isTypeReferenceNode(type2.node) || !type2.node.typeArguments || type2.node.typeArguments.length < typeParameterCount) {
|
|
50245
|
+
while (typeParameterCount > 0) {
|
|
50246
|
+
const typeArgument = typeArguments[typeParameterCount - 1];
|
|
50247
|
+
const typeParameter = type2.target.typeParameters[typeParameterCount - 1];
|
|
50248
|
+
const defaultType = getDefaultFromTypeParameter(typeParameter);
|
|
50249
|
+
if (!defaultType || !isTypeIdenticalTo(typeArgument, defaultType)) {
|
|
50250
|
+
break;
|
|
50251
|
+
}
|
|
50252
|
+
typeParameterCount--;
|
|
50253
|
+
}
|
|
50254
|
+
}
|
|
50255
|
+
}
|
|
50256
|
+
}
|
|
50187
50257
|
typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context);
|
|
50188
50258
|
}
|
|
50189
50259
|
const flags = context.flags;
|
|
@@ -55628,6 +55698,9 @@ function createTypeChecker(host) {
|
|
|
55628
55698
|
links.instantiations = /* @__PURE__ */ new Map();
|
|
55629
55699
|
links.instantiations.set(getTypeListId(typeParameters), type);
|
|
55630
55700
|
}
|
|
55701
|
+
if (type === intrinsicMarkerType && symbol.escapedName === "BuiltinIteratorReturn") {
|
|
55702
|
+
type = strictBuiltinIteratorReturn ? undefinedType : anyType;
|
|
55703
|
+
}
|
|
55631
55704
|
} else {
|
|
55632
55705
|
type = errorType;
|
|
55633
55706
|
if (declaration.kind === 340 /* JSDocEnumTag */) {
|
|
@@ -58905,7 +58978,7 @@ function createTypeChecker(host) {
|
|
|
58905
58978
|
return deferredGlobalAsyncIterableType || (deferredGlobalAsyncIterableType = getGlobalType(
|
|
58906
58979
|
"AsyncIterable",
|
|
58907
58980
|
/*arity*/
|
|
58908
|
-
|
|
58981
|
+
3,
|
|
58909
58982
|
reportErrors2
|
|
58910
58983
|
)) || emptyGenericType;
|
|
58911
58984
|
}
|
|
@@ -58921,7 +58994,15 @@ function createTypeChecker(host) {
|
|
|
58921
58994
|
return deferredGlobalAsyncIterableIteratorType || (deferredGlobalAsyncIterableIteratorType = getGlobalType(
|
|
58922
58995
|
"AsyncIterableIterator",
|
|
58923
58996
|
/*arity*/
|
|
58924
|
-
|
|
58997
|
+
3,
|
|
58998
|
+
reportErrors2
|
|
58999
|
+
)) || emptyGenericType;
|
|
59000
|
+
}
|
|
59001
|
+
function getGlobalAsyncBuiltinIteratorType(reportErrors2) {
|
|
59002
|
+
return deferredGlobalAsyncBuiltinIteratorType || (deferredGlobalAsyncBuiltinIteratorType = getGlobalType(
|
|
59003
|
+
"AsyncBuiltinIterator",
|
|
59004
|
+
/*arity*/
|
|
59005
|
+
3,
|
|
58925
59006
|
reportErrors2
|
|
58926
59007
|
)) || emptyGenericType;
|
|
58927
59008
|
}
|
|
@@ -58937,7 +59018,7 @@ function createTypeChecker(host) {
|
|
|
58937
59018
|
return deferredGlobalIterableType || (deferredGlobalIterableType = getGlobalType(
|
|
58938
59019
|
"Iterable",
|
|
58939
59020
|
/*arity*/
|
|
58940
|
-
|
|
59021
|
+
3,
|
|
58941
59022
|
reportErrors2
|
|
58942
59023
|
)) || emptyGenericType;
|
|
58943
59024
|
}
|
|
@@ -58953,7 +59034,15 @@ function createTypeChecker(host) {
|
|
|
58953
59034
|
return deferredGlobalIterableIteratorType || (deferredGlobalIterableIteratorType = getGlobalType(
|
|
58954
59035
|
"IterableIterator",
|
|
58955
59036
|
/*arity*/
|
|
58956
|
-
|
|
59037
|
+
3,
|
|
59038
|
+
reportErrors2
|
|
59039
|
+
)) || emptyGenericType;
|
|
59040
|
+
}
|
|
59041
|
+
function getGlobalBuiltinIteratorType(reportErrors2) {
|
|
59042
|
+
return deferredGlobalBuiltinIteratorType || (deferredGlobalBuiltinIteratorType = getGlobalType(
|
|
59043
|
+
"BuiltinIterator",
|
|
59044
|
+
/*arity*/
|
|
59045
|
+
3,
|
|
58957
59046
|
reportErrors2
|
|
58958
59047
|
)) || emptyGenericType;
|
|
58959
59048
|
}
|
|
@@ -59135,7 +59224,7 @@ function createTypeChecker(host) {
|
|
|
59135
59224
|
return createTypeFromGenericGlobalType(getGlobalIterableType(
|
|
59136
59225
|
/*reportErrors*/
|
|
59137
59226
|
true
|
|
59138
|
-
), [iteratedType]);
|
|
59227
|
+
), [iteratedType, voidType, undefinedType]);
|
|
59139
59228
|
}
|
|
59140
59229
|
function createArrayType(elementType, readonly) {
|
|
59141
59230
|
return createTypeFromGenericGlobalType(readonly ? globalReadonlyArrayType : globalArrayType, [elementType]);
|
|
@@ -60495,12 +60584,13 @@ function createTypeChecker(host) {
|
|
|
60495
60584
|
}
|
|
60496
60585
|
if (accessNode) {
|
|
60497
60586
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
60498
|
-
if (indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
60587
|
+
if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
60499
60588
|
error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType));
|
|
60500
60589
|
} else if (indexType.flags & (4 /* String */ | 8 /* Number */)) {
|
|
60501
60590
|
error(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
|
|
60502
60591
|
} else {
|
|
60503
|
-
|
|
60592
|
+
const typeString = indexNode.kind === 10 /* BigIntLiteral */ ? "bigint" : typeToString(indexType);
|
|
60593
|
+
error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeString);
|
|
60504
60594
|
}
|
|
60505
60595
|
}
|
|
60506
60596
|
if (isTypeAny(indexType)) {
|
|
@@ -76610,24 +76700,14 @@ function createTypeChecker(host) {
|
|
|
76610
76700
|
void 0
|
|
76611
76701
|
) || unknownType;
|
|
76612
76702
|
if (globalGeneratorType === emptyGenericType) {
|
|
76613
|
-
const
|
|
76703
|
+
const globalIterableIteratorType = resolver.getGlobalIterableIteratorType(
|
|
76614
76704
|
/*reportErrors*/
|
|
76615
76705
|
false
|
|
76616
76706
|
);
|
|
76617
|
-
|
|
76618
|
-
|
|
76619
|
-
const iterableIteratorNextType = iterationTypes ? iterationTypes.nextType : undefinedType;
|
|
76620
|
-
if (isTypeAssignableTo(returnType, iterableIteratorReturnType) && isTypeAssignableTo(iterableIteratorNextType, nextType)) {
|
|
76621
|
-
if (globalType !== emptyGenericType) {
|
|
76622
|
-
return createTypeFromGenericGlobalType(globalType, [yieldType]);
|
|
76623
|
-
}
|
|
76624
|
-
resolver.getGlobalIterableIteratorType(
|
|
76625
|
-
/*reportErrors*/
|
|
76626
|
-
true
|
|
76627
|
-
);
|
|
76628
|
-
return emptyObjectType;
|
|
76707
|
+
if (globalIterableIteratorType !== emptyGenericType) {
|
|
76708
|
+
return createTypeFromGenericGlobalType(globalIterableIteratorType, [yieldType, returnType, nextType]);
|
|
76629
76709
|
}
|
|
76630
|
-
resolver.
|
|
76710
|
+
resolver.getGlobalIterableIteratorType(
|
|
76631
76711
|
/*reportErrors*/
|
|
76632
76712
|
true
|
|
76633
76713
|
);
|
|
@@ -81067,6 +81147,9 @@ function createTypeChecker(host) {
|
|
|
81067
81147
|
checkAliasSymbol(node);
|
|
81068
81148
|
return;
|
|
81069
81149
|
}
|
|
81150
|
+
if (node.name.kind === 10 /* BigIntLiteral */) {
|
|
81151
|
+
error(node.name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name);
|
|
81152
|
+
}
|
|
81070
81153
|
const type = convertAutoToAny(getTypeOfSymbol(symbol));
|
|
81071
81154
|
if (node === symbol.valueDeclaration) {
|
|
81072
81155
|
const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node);
|
|
@@ -81701,41 +81784,17 @@ function createTypeChecker(host) {
|
|
|
81701
81784
|
function getIterationTypesOfIterableCached(type, resolver) {
|
|
81702
81785
|
return getCachedIterationTypes(type, resolver.iterableCacheKey);
|
|
81703
81786
|
}
|
|
81704
|
-
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
81705
|
-
const globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) || getIterationTypesOfIterableSlow(
|
|
81706
|
-
globalType,
|
|
81707
|
-
resolver,
|
|
81708
|
-
/*errorNode*/
|
|
81709
|
-
void 0,
|
|
81710
|
-
/*errorOutputContainer*/
|
|
81711
|
-
void 0,
|
|
81712
|
-
/*noCache*/
|
|
81713
|
-
false
|
|
81714
|
-
);
|
|
81715
|
-
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81716
|
-
}
|
|
81717
81787
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
81718
|
-
|
|
81719
|
-
if (isReferenceToType(type, globalType = resolver.getGlobalIterableType(
|
|
81788
|
+
if (isReferenceToType(type, resolver.getGlobalIterableType(
|
|
81720
81789
|
/*reportErrors*/
|
|
81721
81790
|
false
|
|
81722
|
-
)) || isReferenceToType(type,
|
|
81791
|
+
)) || isReferenceToType(type, resolver.getGlobalBuiltinIteratorType(
|
|
81723
81792
|
/*reportErrors*/
|
|
81724
81793
|
false
|
|
81725
|
-
))
|
|
81726
|
-
|
|
81727
|
-
|
|
81728
|
-
|
|
81729
|
-
yieldType,
|
|
81730
|
-
/*errorNode*/
|
|
81731
|
-
void 0
|
|
81732
|
-
) || yieldType, resolver.resolveIterationType(
|
|
81733
|
-
returnType,
|
|
81734
|
-
/*errorNode*/
|
|
81735
|
-
void 0
|
|
81736
|
-
) || returnType, nextType));
|
|
81737
|
-
}
|
|
81738
|
-
if (isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
81794
|
+
)) || isReferenceToType(type, resolver.getGlobalIterableIteratorType(
|
|
81795
|
+
/*reportErrors*/
|
|
81796
|
+
false
|
|
81797
|
+
)) || isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
81739
81798
|
/*reportErrors*/
|
|
81740
81799
|
false
|
|
81741
81800
|
))) {
|
|
@@ -81780,10 +81839,10 @@ function createTypeChecker(host) {
|
|
|
81780
81839
|
!!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType(
|
|
81781
81840
|
/*reportErrors*/
|
|
81782
81841
|
false
|
|
81783
|
-
) !== emptyGenericType && isTypeAssignableTo(type, getGlobalAsyncIterableType(
|
|
81842
|
+
) !== emptyGenericType && isTypeAssignableTo(type, createTypeFromGenericGlobalType(getGlobalAsyncIterableType(
|
|
81784
81843
|
/*reportErrors*/
|
|
81785
81844
|
false
|
|
81786
|
-
))
|
|
81845
|
+
), [anyType, anyType, anyType]))
|
|
81787
81846
|
);
|
|
81788
81847
|
return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type));
|
|
81789
81848
|
}
|
|
@@ -81813,26 +81872,13 @@ function createTypeChecker(host) {
|
|
|
81813
81872
|
return getCachedIterationTypes(type, resolver.iteratorCacheKey);
|
|
81814
81873
|
}
|
|
81815
81874
|
function getIterationTypesOfIteratorFast(type, resolver) {
|
|
81816
|
-
|
|
81875
|
+
if (isReferenceToType(type, resolver.getGlobalBuiltinIteratorType(
|
|
81817
81876
|
/*reportErrors*/
|
|
81818
81877
|
false
|
|
81819
|
-
)
|
|
81820
|
-
|
|
81821
|
-
|
|
81822
|
-
|
|
81823
|
-
globalType,
|
|
81824
|
-
resolver,
|
|
81825
|
-
/*errorNode*/
|
|
81826
|
-
void 0,
|
|
81827
|
-
/*errorOutputContainer*/
|
|
81828
|
-
void 0,
|
|
81829
|
-
/*noCache*/
|
|
81830
|
-
false
|
|
81831
|
-
);
|
|
81832
|
-
const { returnType, nextType } = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
81833
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
81834
|
-
}
|
|
81835
|
-
if (isReferenceToType(type, resolver.getGlobalIteratorType(
|
|
81878
|
+
)) || isReferenceToType(type, resolver.getGlobalIterableIteratorType(
|
|
81879
|
+
/*reportErrors*/
|
|
81880
|
+
false
|
|
81881
|
+
)) || isReferenceToType(type, resolver.getGlobalIteratorType(
|
|
81836
81882
|
/*reportErrors*/
|
|
81837
81883
|
false
|
|
81838
81884
|
)) || isReferenceToType(type, resolver.getGlobalGeneratorType(
|
|
@@ -81909,7 +81955,7 @@ function createTypeChecker(host) {
|
|
|
81909
81955
|
}
|
|
81910
81956
|
const methodType = method && !(methodName === "next" && method.flags & 16777216 /* Optional */) ? methodName === "next" ? getTypeOfSymbol(method) : getTypeWithFacts(getTypeOfSymbol(method), 2097152 /* NEUndefinedOrNull */) : void 0;
|
|
81911
81957
|
if (isTypeAny(methodType)) {
|
|
81912
|
-
return
|
|
81958
|
+
return anyIterationTypes;
|
|
81913
81959
|
}
|
|
81914
81960
|
const methodSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : emptyArray;
|
|
81915
81961
|
if (methodSignatures.length === 0) {
|
|
@@ -83047,7 +83093,9 @@ function createTypeChecker(host) {
|
|
|
83047
83093
|
checkExportsOnMergedDeclarations(node);
|
|
83048
83094
|
checkTypeParameters(node.typeParameters);
|
|
83049
83095
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
83050
|
-
|
|
83096
|
+
const typeParameterCount = length(node.typeParameters);
|
|
83097
|
+
const valid = typeParameterCount === 0 ? node.name.escapedText === "BuiltinIteratorReturn" : typeParameterCount === 1 && intrinsicTypeKinds.has(node.name.escapedText);
|
|
83098
|
+
if (!valid) {
|
|
83051
83099
|
error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
83052
83100
|
}
|
|
83053
83101
|
} else {
|
|
@@ -83687,6 +83735,8 @@ function createTypeChecker(host) {
|
|
|
83687
83735
|
}
|
|
83688
83736
|
}
|
|
83689
83737
|
}
|
|
83738
|
+
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
83739
|
+
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
83690
83740
|
}
|
|
83691
83741
|
}
|
|
83692
83742
|
checkImportAttributes(node);
|
|
@@ -86964,6 +87014,13 @@ function createTypeChecker(host) {
|
|
|
86964
87014
|
if (name.kind === 9 /* NumericLiteral */) {
|
|
86965
87015
|
checkGrammarNumericLiteral(name);
|
|
86966
87016
|
}
|
|
87017
|
+
if (name.kind === 10 /* BigIntLiteral */) {
|
|
87018
|
+
addErrorOrSuggestion(
|
|
87019
|
+
/*isError*/
|
|
87020
|
+
true,
|
|
87021
|
+
createDiagnosticForNode(name, Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name)
|
|
87022
|
+
);
|
|
87023
|
+
}
|
|
86967
87024
|
currentKind = 4 /* PropertyAssignment */;
|
|
86968
87025
|
break;
|
|
86969
87026
|
case 174 /* MethodDeclaration */:
|
|
@@ -90521,7 +90578,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
|
|
|
90521
90578
|
propertyName
|
|
90522
90579
|
);
|
|
90523
90580
|
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
|
|
90524
|
-
} else if (isStringOrNumericLiteralLike(propertyName)) {
|
|
90581
|
+
} else if (isStringOrNumericLiteralLike(propertyName) || isBigIntLiteral(propertyName)) {
|
|
90525
90582
|
const argumentExpression = factory2.cloneNode(propertyName);
|
|
90526
90583
|
return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
|
|
90527
90584
|
} else {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -4422,7 +4422,7 @@ declare namespace ts {
|
|
|
4422
4422
|
readonly right: Identifier;
|
|
4423
4423
|
}
|
|
4424
4424
|
type EntityName = Identifier | QualifiedName;
|
|
4425
|
-
type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
|
|
4425
|
+
type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | BigIntLiteral;
|
|
4426
4426
|
type MemberName = Identifier | PrivateIdentifier;
|
|
4427
4427
|
type DeclarationName = PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
|
|
4428
4428
|
interface Declaration extends Node {
|
|
@@ -4773,7 +4773,7 @@ declare namespace ts {
|
|
|
4773
4773
|
readonly kind: SyntaxKind.StringLiteral;
|
|
4774
4774
|
}
|
|
4775
4775
|
type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
|
|
4776
|
-
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName;
|
|
4776
|
+
type PropertyNameLiteral = Identifier | StringLiteralLike | NumericLiteral | JsxNamespacedName | BigIntLiteral;
|
|
4777
4777
|
interface TemplateLiteralTypeNode extends TypeNode {
|
|
4778
4778
|
kind: SyntaxKind.TemplateLiteralType;
|
|
4779
4779
|
readonly head: TemplateHead;
|
|
@@ -7008,6 +7008,7 @@ declare namespace ts {
|
|
|
7008
7008
|
strictBindCallApply?: boolean;
|
|
7009
7009
|
strictNullChecks?: boolean;
|
|
7010
7010
|
strictPropertyInitialization?: boolean;
|
|
7011
|
+
strictBuiltinIteratorReturn?: boolean;
|
|
7011
7012
|
stripInternal?: boolean;
|
|
7012
7013
|
/** @deprecated */
|
|
7013
7014
|
suppressExcessPropertyErrors?: boolean;
|
|
@@ -7016,6 +7017,7 @@ declare namespace ts {
|
|
|
7016
7017
|
target?: ScriptTarget;
|
|
7017
7018
|
traceResolution?: boolean;
|
|
7018
7019
|
useUnknownInCatchVariables?: boolean;
|
|
7020
|
+
noUncheckedSideEffectImports?: boolean;
|
|
7019
7021
|
resolveJsonModule?: boolean;
|
|
7020
7022
|
types?: string[];
|
|
7021
7023
|
/** Paths used to compute primary types search locations */
|