@typescript-deploys/pr-build 5.7.0-pr-59417-7 → 5.7.0-pr-59759-2
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.es2015.core.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +27 -90
- package/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
- package/lib/lib.es2016.array.include.d.ts +9 -9
- package/lib/lib.es2017.sharedmemory.d.ts +12 -12
- package/lib/lib.es2017.typedarrays.d.ts +9 -9
- package/lib/lib.es2020.bigint.d.ts +49 -51
- package/lib/lib.es2020.sharedmemory.d.ts +11 -11
- package/lib/lib.es2022.array.d.ts +11 -11
- package/lib/lib.es2023.array.d.ts +99 -99
- package/lib/lib.es5.d.ts +251 -251
- package/lib/tsc.js +105 -12
- package/lib/typescript.js +564 -388
- package/package.json +1 -1
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.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240826`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1203,6 +1203,73 @@ function skipWhile(array, predicate) {
|
|
|
1203
1203
|
function isNodeLikeSystem() {
|
|
1204
1204
|
return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof require !== "undefined";
|
|
1205
1205
|
}
|
|
1206
|
+
function createPrefixSuffixTrie() {
|
|
1207
|
+
function createTrie() {
|
|
1208
|
+
return {
|
|
1209
|
+
children: void 0,
|
|
1210
|
+
value: void 0
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
const root = createTrie();
|
|
1214
|
+
function* iterateAllMatches(input) {
|
|
1215
|
+
var _a;
|
|
1216
|
+
let node = root;
|
|
1217
|
+
if (node.value) {
|
|
1218
|
+
yield* iterateSuffix(node.value, 0);
|
|
1219
|
+
}
|
|
1220
|
+
for (let i = 0; i < input.length; i++) {
|
|
1221
|
+
const child = (_a = node.children) == null ? void 0 : _a[input[i]];
|
|
1222
|
+
if (!child) break;
|
|
1223
|
+
if (child.value) {
|
|
1224
|
+
yield* iterateSuffix(child.value, i + 1);
|
|
1225
|
+
}
|
|
1226
|
+
node = child;
|
|
1227
|
+
}
|
|
1228
|
+
return;
|
|
1229
|
+
function* iterateSuffix(node2, start) {
|
|
1230
|
+
var _a2;
|
|
1231
|
+
if (node2.value) {
|
|
1232
|
+
yield node2.value;
|
|
1233
|
+
}
|
|
1234
|
+
for (let i = input.length - 1; i >= start; i--) {
|
|
1235
|
+
const child = (_a2 = node2.children) == null ? void 0 : _a2[input[i]];
|
|
1236
|
+
if (!child) break;
|
|
1237
|
+
if (child.value) {
|
|
1238
|
+
yield child.value;
|
|
1239
|
+
}
|
|
1240
|
+
node2 = child;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
function set(prefix, suffix, fn) {
|
|
1245
|
+
let prefixNode = root;
|
|
1246
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
1247
|
+
const char = prefix[i];
|
|
1248
|
+
const children = prefixNode.children ?? (prefixNode.children = {});
|
|
1249
|
+
const child = children[char] ?? (children[char] = createTrie());
|
|
1250
|
+
prefixNode = child;
|
|
1251
|
+
}
|
|
1252
|
+
let suffixNode = prefixNode.value ?? (prefixNode.value = createTrie());
|
|
1253
|
+
for (let i = suffix.length - 1; i >= 0; i--) {
|
|
1254
|
+
const char = suffix[i];
|
|
1255
|
+
const children = suffixNode.children ?? (suffixNode.children = {});
|
|
1256
|
+
const child = children[char] ?? (children[char] = createTrie());
|
|
1257
|
+
suffixNode = child;
|
|
1258
|
+
}
|
|
1259
|
+
suffixNode.value = fn(suffixNode.value);
|
|
1260
|
+
}
|
|
1261
|
+
function hasAnyMatch(input) {
|
|
1262
|
+
for (const _ of iterateAllMatches(input)) {
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1265
|
+
return false;
|
|
1266
|
+
}
|
|
1267
|
+
return {
|
|
1268
|
+
iterateAllMatches,
|
|
1269
|
+
set,
|
|
1270
|
+
hasAnyMatch
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1206
1273
|
|
|
1207
1274
|
// src/compiler/debug.ts
|
|
1208
1275
|
var Debug;
|
|
@@ -6139,6 +6206,8 @@ var Diagnostics = {
|
|
|
6139
6206
|
/*reportsDeprecated*/
|
|
6140
6207
|
true
|
|
6141
6208
|
),
|
|
6209
|
+
Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1 /* Error */, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
6210
|
+
Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1 /* Error */, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
6142
6211
|
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."),
|
|
6143
6212
|
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."),
|
|
6144
6213
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -7846,6 +7915,8 @@ var Diagnostics = {
|
|
|
7846
7915
|
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7847
7916
|
Wrap_in_parentheses: diag(95194, 3 /* Message */, "Wrap_in_parentheses_95194", "Wrap in parentheses"),
|
|
7848
7917
|
Wrap_all_invalid_decorator_expressions_in_parentheses: diag(95195, 3 /* Message */, "Wrap_all_invalid_decorator_expressions_in_parentheses_95195", "Wrap all invalid decorator expressions in parentheses"),
|
|
7918
|
+
Add_resolution_mode_import_attribute: diag(95196, 3 /* Message */, "Add_resolution_mode_import_attribute_95196", "Add 'resolution-mode' import attribute"),
|
|
7919
|
+
Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it: diag(95197, 3 /* Message */, "Add_resolution_mode_import_attribute_to_all_type_only_imports_that_need_it_95197", "Add 'resolution-mode' import attribute to all type-only imports that need it"),
|
|
7849
7920
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7850
7921
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7851
7922
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -48455,7 +48526,7 @@ function createTypeChecker(host) {
|
|
|
48455
48526
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
48456
48527
|
}
|
|
48457
48528
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
48458
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
48529
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
48459
48530
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
48460
48531
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
48461
48532
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -48524,14 +48595,11 @@ function createTypeChecker(host) {
|
|
|
48524
48595
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
48525
48596
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
48526
48597
|
}
|
|
48598
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
48527
48599
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
48528
48600
|
getSourceFileOfNode(errorNode),
|
|
48529
48601
|
errorNode,
|
|
48530
|
-
chainDiagnosticMessages(
|
|
48531
|
-
diagnosticDetails,
|
|
48532
|
-
Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead,
|
|
48533
|
-
moduleReference
|
|
48534
|
-
)
|
|
48602
|
+
chainDiagnosticMessages(diagnosticDetails, message, moduleReference)
|
|
48535
48603
|
));
|
|
48536
48604
|
}
|
|
48537
48605
|
}
|
|
@@ -48590,14 +48658,14 @@ function createTypeChecker(host) {
|
|
|
48590
48658
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48591
48659
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
48592
48660
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
48593
|
-
const suggestedExt = (
|
|
48661
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
48594
48662
|
if (suggestedExt) {
|
|
48595
48663
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
48596
48664
|
} else {
|
|
48597
48665
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
48598
48666
|
}
|
|
48599
48667
|
} else {
|
|
48600
|
-
if ((
|
|
48668
|
+
if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
|
|
48601
48669
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
48602
48670
|
errorOrSuggestion(
|
|
48603
48671
|
/*isError*/
|
|
@@ -59920,13 +59988,38 @@ function createTypeChecker(host) {
|
|
|
59920
59988
|
}
|
|
59921
59989
|
}
|
|
59922
59990
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
59923
|
-
|
|
59924
|
-
|
|
59991
|
+
let patterns = filter(types, isPatternLiteralType);
|
|
59992
|
+
const templateLiterals = filter(patterns, (t) => !!(t.flags & 134217728 /* TemplateLiteral */));
|
|
59993
|
+
const estimatedCount = templateLiterals.length * countWhere(types, (t) => !!(t.flags & 128 /* StringLiteral */));
|
|
59994
|
+
if (estimatedCount > 0) {
|
|
59995
|
+
const trie = createPrefixSuffixTrie();
|
|
59996
|
+
forEach(templateLiterals, (t) => {
|
|
59997
|
+
const prefix = t.texts[0];
|
|
59998
|
+
const suffix = t.texts[t.texts.length - 1];
|
|
59999
|
+
trie.set(prefix, suffix, (templates) => append(templates, t));
|
|
60000
|
+
});
|
|
60001
|
+
let i = types.length;
|
|
60002
|
+
outer: while (i > 0) {
|
|
60003
|
+
i--;
|
|
60004
|
+
const t = types[i];
|
|
60005
|
+
if (!(t.flags & 128 /* StringLiteral */)) continue;
|
|
60006
|
+
const text = t.value;
|
|
60007
|
+
for (const templates of trie.iterateAllMatches(text)) {
|
|
60008
|
+
if (some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
|
|
60009
|
+
orderedRemoveItemAt(types, i);
|
|
60010
|
+
continue outer;
|
|
60011
|
+
}
|
|
60012
|
+
}
|
|
60013
|
+
}
|
|
60014
|
+
patterns = filter(patterns, (t) => !!(t.flags & 268435456 /* StringMapping */));
|
|
60015
|
+
}
|
|
60016
|
+
if (patterns.length) {
|
|
59925
60017
|
let i = types.length;
|
|
59926
60018
|
while (i > 0) {
|
|
59927
60019
|
i--;
|
|
59928
60020
|
const t = types[i];
|
|
59929
|
-
if (t.flags & 128 /* StringLiteral */
|
|
60021
|
+
if (!(t.flags & 128 /* StringLiteral */)) continue;
|
|
60022
|
+
if (some(patterns, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) {
|
|
59930
60023
|
orderedRemoveItemAt(types, i);
|
|
59931
60024
|
}
|
|
59932
60025
|
}
|