typescript 5.6.0-dev.20240715 → 5.6.0-dev.20240717
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.es2023.array.d.ts +5 -5
- package/lib/tsc.js +157 -131
- package/lib/typescript.js +171 -140
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -410,6 +410,7 @@ __export(typescript_exports, {
|
|
|
410
410
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
411
411
|
createModeAwareCache: () => createModeAwareCache,
|
|
412
412
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
413
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
413
414
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
414
415
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
415
416
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -2251,7 +2252,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2251
2252
|
|
|
2252
2253
|
// src/compiler/corePublic.ts
|
|
2253
2254
|
var versionMajorMinor = "5.6";
|
|
2254
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2255
|
+
var version = `${versionMajorMinor}.0-dev.20240717`;
|
|
2255
2256
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2256
2257
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2257
2258
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5051,10 +5052,12 @@ function tryGetPerformance() {
|
|
|
5051
5052
|
if (isNodeLikeSystem()) {
|
|
5052
5053
|
try {
|
|
5053
5054
|
const { performance: performance2 } = require("perf_hooks");
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5055
|
+
if (performance2) {
|
|
5056
|
+
return {
|
|
5057
|
+
shouldWriteNativeEvents: false,
|
|
5058
|
+
performance: performance2
|
|
5059
|
+
};
|
|
5060
|
+
}
|
|
5058
5061
|
} catch {
|
|
5059
5062
|
}
|
|
5060
5063
|
}
|
|
@@ -5978,10 +5981,12 @@ var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
|
5978
5981
|
RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
|
|
5979
5982
|
RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
|
|
5980
5983
|
RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
|
|
5981
|
-
RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
|
|
5982
5984
|
RelationComparisonResult3[RelationComparisonResult3["ReportsUnmeasurable"] = 8] = "ReportsUnmeasurable";
|
|
5983
5985
|
RelationComparisonResult3[RelationComparisonResult3["ReportsUnreliable"] = 16] = "ReportsUnreliable";
|
|
5984
5986
|
RelationComparisonResult3[RelationComparisonResult3["ReportsMask"] = 24] = "ReportsMask";
|
|
5987
|
+
RelationComparisonResult3[RelationComparisonResult3["ComplexityOverflow"] = 32] = "ComplexityOverflow";
|
|
5988
|
+
RelationComparisonResult3[RelationComparisonResult3["StackDepthOverflow"] = 64] = "StackDepthOverflow";
|
|
5989
|
+
RelationComparisonResult3[RelationComparisonResult3["Overflow"] = 96] = "Overflow";
|
|
5985
5990
|
return RelationComparisonResult3;
|
|
5986
5991
|
})(RelationComparisonResult || {});
|
|
5987
5992
|
var GeneratedIdentifierFlags = /* @__PURE__ */ ((GeneratedIdentifierFlags2) => {
|
|
@@ -6526,7 +6531,7 @@ var AccessFlags = /* @__PURE__ */ ((AccessFlags2) => {
|
|
|
6526
6531
|
AccessFlags2[AccessFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures";
|
|
6527
6532
|
AccessFlags2[AccessFlags2["Writing"] = 4] = "Writing";
|
|
6528
6533
|
AccessFlags2[AccessFlags2["CacheSymbol"] = 8] = "CacheSymbol";
|
|
6529
|
-
AccessFlags2[AccessFlags2["
|
|
6534
|
+
AccessFlags2[AccessFlags2["AllowMissing"] = 16] = "AllowMissing";
|
|
6530
6535
|
AccessFlags2[AccessFlags2["ExpressionPosition"] = 32] = "ExpressionPosition";
|
|
6531
6536
|
AccessFlags2[AccessFlags2["ReportDeprecated"] = 64] = "ReportDeprecated";
|
|
6532
6537
|
AccessFlags2[AccessFlags2["SuppressNoImplicitAnyError"] = 128] = "SuppressNoImplicitAnyError";
|
|
@@ -9752,7 +9757,6 @@ var Diagnostics = {
|
|
|
9752
9757
|
The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_standard_function_or_method: diag(2522, 1 /* Error */, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES5_Consider_using_a_sta_2522", "The 'arguments' object cannot be referenced in an async function or method in ES5. Consider using a standard function or method."),
|
|
9753
9758
|
yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, 1 /* Error */, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."),
|
|
9754
9759
|
await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, 1 /* Error */, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."),
|
|
9755
|
-
Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, 1 /* Error */, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."),
|
|
9756
9760
|
A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, 1 /* Error */, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."),
|
|
9757
9761
|
The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary: diag(2527, 1 /* Error */, "The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible '{1}' type. A type annotation is necessary."),
|
|
9758
9762
|
A_module_cannot_have_multiple_default_exports: diag(2528, 1 /* Error */, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."),
|
|
@@ -16168,6 +16172,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
16168
16172
|
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
16169
16173
|
return result;
|
|
16170
16174
|
}
|
|
16175
|
+
function createModeMismatchDetails(currentSourceFile) {
|
|
16176
|
+
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
16177
|
+
const scope = currentSourceFile.packageJsonScope;
|
|
16178
|
+
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
16179
|
+
const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
|
|
16180
|
+
/*details*/
|
|
16181
|
+
void 0,
|
|
16182
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
16183
|
+
targetExt,
|
|
16184
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16185
|
+
) : chainDiagnosticMessages(
|
|
16186
|
+
/*details*/
|
|
16187
|
+
void 0,
|
|
16188
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
16189
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16190
|
+
) : targetExt ? chainDiagnosticMessages(
|
|
16191
|
+
/*details*/
|
|
16192
|
+
void 0,
|
|
16193
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
16194
|
+
targetExt
|
|
16195
|
+
) : chainDiagnosticMessages(
|
|
16196
|
+
/*details*/
|
|
16197
|
+
void 0,
|
|
16198
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
16199
|
+
);
|
|
16200
|
+
result.repopulateInfo = () => true;
|
|
16201
|
+
return result;
|
|
16202
|
+
}
|
|
16171
16203
|
function packageIdIsEqual(a, b) {
|
|
16172
16204
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
16173
16205
|
}
|
|
@@ -44616,22 +44648,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
44616
44648
|
resolvedPackageDirectory: false
|
|
44617
44649
|
};
|
|
44618
44650
|
}
|
|
44619
|
-
function getPackageScopeForPath(
|
|
44620
|
-
|
|
44621
|
-
|
|
44622
|
-
|
|
44623
|
-
|
|
44624
|
-
getPathFromPathComponents(parts),
|
|
44651
|
+
function getPackageScopeForPath(directory, state) {
|
|
44652
|
+
return forEachAncestorDirectory(
|
|
44653
|
+
directory,
|
|
44654
|
+
(dir) => getPackageJsonInfo(
|
|
44655
|
+
dir,
|
|
44625
44656
|
/*onlyRecordFailures*/
|
|
44626
44657
|
false,
|
|
44627
44658
|
state
|
|
44628
|
-
)
|
|
44629
|
-
|
|
44630
|
-
return pkg;
|
|
44631
|
-
}
|
|
44632
|
-
parts.pop();
|
|
44633
|
-
}
|
|
44634
|
-
return void 0;
|
|
44659
|
+
)
|
|
44660
|
+
);
|
|
44635
44661
|
}
|
|
44636
44662
|
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
44637
44663
|
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
@@ -44794,7 +44820,7 @@ function noKeyStartsWithDot(obj) {
|
|
|
44794
44820
|
}
|
|
44795
44821
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
44796
44822
|
var _a, _b;
|
|
44797
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44823
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44798
44824
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44799
44825
|
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
44800
44826
|
return void 0;
|
|
@@ -44890,7 +44916,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
|
|
|
44890
44916
|
void 0
|
|
44891
44917
|
);
|
|
44892
44918
|
}
|
|
44893
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44919
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44894
44920
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44895
44921
|
if (!scope) {
|
|
44896
44922
|
if (state.traceEnabled) {
|
|
@@ -49119,7 +49145,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
|
|
|
49119
49145
|
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
49120
49146
|
Debug.type(host);
|
|
49121
49147
|
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
49122
|
-
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
49148
|
+
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
49123
49149
|
if (packageJson) {
|
|
49124
49150
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
49125
49151
|
for (const depName of toResolve || emptyArray) {
|
|
@@ -50733,6 +50759,7 @@ function createTypeChecker(host) {
|
|
|
50733
50759
|
var contextualTypes = [];
|
|
50734
50760
|
var contextualIsCache = [];
|
|
50735
50761
|
var contextualTypeCount = 0;
|
|
50762
|
+
var contextualBindingPatterns = [];
|
|
50736
50763
|
var inferenceContextNodes = [];
|
|
50737
50764
|
var inferenceContexts = [];
|
|
50738
50765
|
var inferenceContextCount = 0;
|
|
@@ -52787,41 +52814,7 @@ function createTypeChecker(host) {
|
|
|
52787
52814
|
let diagnosticDetails;
|
|
52788
52815
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
52789
52816
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
52790
|
-
|
|
52791
|
-
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
52792
|
-
if (scope && !scope.contents.packageJsonContent.type) {
|
|
52793
|
-
if (targetExt) {
|
|
52794
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52795
|
-
/*details*/
|
|
52796
|
-
void 0,
|
|
52797
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
52798
|
-
targetExt,
|
|
52799
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52800
|
-
);
|
|
52801
|
-
} else {
|
|
52802
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52803
|
-
/*details*/
|
|
52804
|
-
void 0,
|
|
52805
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
52806
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52807
|
-
);
|
|
52808
|
-
}
|
|
52809
|
-
} else {
|
|
52810
|
-
if (targetExt) {
|
|
52811
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52812
|
-
/*details*/
|
|
52813
|
-
void 0,
|
|
52814
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
52815
|
-
targetExt
|
|
52816
|
-
);
|
|
52817
|
-
} else {
|
|
52818
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52819
|
-
/*details*/
|
|
52820
|
-
void 0,
|
|
52821
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
52822
|
-
);
|
|
52823
|
-
}
|
|
52824
|
-
}
|
|
52817
|
+
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
52825
52818
|
}
|
|
52826
52819
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
52827
52820
|
getSourceFileOfNode(errorNode),
|
|
@@ -56681,7 +56674,7 @@ function createTypeChecker(host) {
|
|
|
56681
56674
|
if (result) {
|
|
56682
56675
|
if (result.pos !== -1 || result.end !== -1) {
|
|
56683
56676
|
if (result === nodes) {
|
|
56684
|
-
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
56677
|
+
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
|
|
56685
56678
|
}
|
|
56686
56679
|
setTextRangePosEnd(result, -1, -1);
|
|
56687
56680
|
}
|
|
@@ -58757,6 +58750,7 @@ function createTypeChecker(host) {
|
|
|
58757
58750
|
} else if (strictNullChecks && pattern.parent.initializer && !hasTypeFacts(getTypeOfInitializer(pattern.parent.initializer), 65536 /* EQUndefined */)) {
|
|
58758
58751
|
parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */);
|
|
58759
58752
|
}
|
|
58753
|
+
const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* AllowMissing */ : 0);
|
|
58760
58754
|
let type;
|
|
58761
58755
|
if (pattern.kind === 206 /* ObjectBindingPattern */) {
|
|
58762
58756
|
if (declaration.dotDotDotToken) {
|
|
@@ -58775,7 +58769,7 @@ function createTypeChecker(host) {
|
|
|
58775
58769
|
} else {
|
|
58776
58770
|
const name = declaration.propertyName || declaration.name;
|
|
58777
58771
|
const indexType = getLiteralTypeFromPropertyName(name);
|
|
58778
|
-
const declaredType = getIndexedAccessType(parentType, indexType,
|
|
58772
|
+
const declaredType = getIndexedAccessType(parentType, indexType, accessFlags, name);
|
|
58779
58773
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
58780
58774
|
}
|
|
58781
58775
|
} else {
|
|
@@ -58786,7 +58780,6 @@ function createTypeChecker(host) {
|
|
|
58786
58780
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
58787
58781
|
} else if (isArrayLikeType(parentType)) {
|
|
58788
58782
|
const indexType = getNumberLiteralType(index);
|
|
58789
|
-
const accessFlags = 32 /* ExpressionPosition */ | (noTupleBoundsCheck || hasDefaultValue(declaration) ? 16 /* NoTupleBoundsCheck */ : 0);
|
|
58790
58783
|
const declaredType = getIndexedAccessTypeOrUndefined(parentType, indexType, accessFlags, declaration.name) || errorType;
|
|
58791
58784
|
type = getFlowTypeOfDestructuring(declaration, declaredType);
|
|
58792
58785
|
} else {
|
|
@@ -59272,7 +59265,7 @@ function createTypeChecker(host) {
|
|
|
59272
59265
|
/*reportErrors*/
|
|
59273
59266
|
false
|
|
59274
59267
|
) : unknownType;
|
|
59275
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element,
|
|
59268
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
59276
59269
|
}
|
|
59277
59270
|
if (isBindingPattern(element.name)) {
|
|
59278
59271
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
|
|
@@ -59343,7 +59336,10 @@ function createTypeChecker(host) {
|
|
|
59343
59336
|
return result;
|
|
59344
59337
|
}
|
|
59345
59338
|
function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) {
|
|
59346
|
-
|
|
59339
|
+
if (includePatternInType) contextualBindingPatterns.push(pattern);
|
|
59340
|
+
const result = pattern.kind === 206 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2);
|
|
59341
|
+
if (includePatternInType) contextualBindingPatterns.pop();
|
|
59342
|
+
return result;
|
|
59347
59343
|
}
|
|
59348
59344
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors2) {
|
|
59349
59345
|
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(
|
|
@@ -59424,18 +59420,18 @@ function createTypeChecker(host) {
|
|
|
59424
59420
|
}
|
|
59425
59421
|
return false;
|
|
59426
59422
|
}
|
|
59427
|
-
function getTypeOfVariableOrParameterOrProperty(symbol
|
|
59423
|
+
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
59428
59424
|
const links = getSymbolLinks(symbol);
|
|
59429
59425
|
if (!links.type) {
|
|
59430
|
-
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol
|
|
59431
|
-
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)
|
|
59426
|
+
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
59427
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
59432
59428
|
links.type = type;
|
|
59433
59429
|
}
|
|
59434
59430
|
return type;
|
|
59435
59431
|
}
|
|
59436
59432
|
return links.type;
|
|
59437
59433
|
}
|
|
59438
|
-
function getTypeOfVariableOrParameterOrPropertyWorker(symbol
|
|
59434
|
+
function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
|
|
59439
59435
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
59440
59436
|
return getTypeOfPrototypeProperty(symbol);
|
|
59441
59437
|
}
|
|
@@ -59470,9 +59466,6 @@ function createTypeChecker(host) {
|
|
|
59470
59466
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
59471
59467
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
59472
59468
|
}
|
|
59473
|
-
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
59474
|
-
return errorType;
|
|
59475
|
-
}
|
|
59476
59469
|
return reportCircularityError(symbol);
|
|
59477
59470
|
}
|
|
59478
59471
|
let type;
|
|
@@ -59510,9 +59503,6 @@ function createTypeChecker(host) {
|
|
|
59510
59503
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
59511
59504
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
59512
59505
|
}
|
|
59513
|
-
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
59514
|
-
return type;
|
|
59515
|
-
}
|
|
59516
59506
|
return reportCircularityError(symbol);
|
|
59517
59507
|
}
|
|
59518
59508
|
return type;
|
|
@@ -59741,7 +59731,7 @@ function createTypeChecker(host) {
|
|
|
59741
59731
|
}
|
|
59742
59732
|
return getTypeOfSymbol(symbol);
|
|
59743
59733
|
}
|
|
59744
|
-
function getTypeOfSymbol(symbol
|
|
59734
|
+
function getTypeOfSymbol(symbol) {
|
|
59745
59735
|
const checkFlags = getCheckFlags(symbol);
|
|
59746
59736
|
if (checkFlags & 65536 /* DeferredType */) {
|
|
59747
59737
|
return getTypeOfSymbolWithDeferredType(symbol);
|
|
@@ -59756,7 +59746,7 @@ function createTypeChecker(host) {
|
|
|
59756
59746
|
return getTypeOfReverseMappedSymbol(symbol);
|
|
59757
59747
|
}
|
|
59758
59748
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
59759
|
-
return getTypeOfVariableOrParameterOrProperty(symbol
|
|
59749
|
+
return getTypeOfVariableOrParameterOrProperty(symbol);
|
|
59760
59750
|
}
|
|
59761
59751
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
|
|
59762
59752
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
@@ -62903,14 +62893,14 @@ function createTypeChecker(host) {
|
|
|
62903
62893
|
var _a, _b;
|
|
62904
62894
|
if (!type.resolvedTypeArguments) {
|
|
62905
62895
|
if (!pushTypeResolution(type, 5 /* ResolvedTypeArguments */)) {
|
|
62906
|
-
return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
62896
|
+
return concatenate(type.target.outerTypeParameters, (_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
62907
62897
|
}
|
|
62908
62898
|
const node = type.node;
|
|
62909
62899
|
const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
|
|
62910
62900
|
if (popTypeResolution()) {
|
|
62911
62901
|
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments);
|
|
62912
62902
|
} else {
|
|
62913
|
-
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray);
|
|
62903
|
+
type.resolvedTypeArguments ?? (type.resolvedTypeArguments = concatenate(type.target.outerTypeParameters, ((_b = type.target.localTypeParameters) == null ? void 0 : _b.map(() => errorType)) || emptyArray));
|
|
62914
62904
|
error2(
|
|
62915
62905
|
type.node || currentNode,
|
|
62916
62906
|
type.target.symbol ? Diagnostics.Type_arguments_for_0_circularly_reference_themselves : Diagnostics.Tuple_type_arguments_circularly_reference_themselves,
|
|
@@ -64906,7 +64896,7 @@ function createTypeChecker(host) {
|
|
|
64906
64896
|
}
|
|
64907
64897
|
if (everyType(objectType, isTupleType) && isNumericLiteralName(propName)) {
|
|
64908
64898
|
const index = +propName;
|
|
64909
|
-
if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /*
|
|
64899
|
+
if (accessNode && everyType(objectType, (t) => !(t.target.combinedFlags & 12 /* Variable */)) && !(accessFlags & 16 /* AllowMissing */)) {
|
|
64910
64900
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
64911
64901
|
if (isTupleType(objectType)) {
|
|
64912
64902
|
if (index < 0) {
|
|
@@ -65045,6 +65035,9 @@ function createTypeChecker(host) {
|
|
|
65045
65035
|
return void 0;
|
|
65046
65036
|
}
|
|
65047
65037
|
}
|
|
65038
|
+
if (accessFlags & 16 /* AllowMissing */ && isObjectLiteralType2(objectType)) {
|
|
65039
|
+
return undefinedType;
|
|
65040
|
+
}
|
|
65048
65041
|
if (isJSLiteralType(objectType)) {
|
|
65049
65042
|
return anyType;
|
|
65050
65043
|
}
|
|
@@ -67316,7 +67309,7 @@ function createTypeChecker(host) {
|
|
|
67316
67309
|
}
|
|
67317
67310
|
const id = getSymbolId(sourceSymbol) + "," + getSymbolId(targetSymbol);
|
|
67318
67311
|
const entry = enumRelation.get(id);
|
|
67319
|
-
if (entry !== void 0 && !(
|
|
67312
|
+
if (entry !== void 0 && !(entry & 2 /* Failed */ && errorReporter)) {
|
|
67320
67313
|
return !!(entry & 1 /* Succeeded */);
|
|
67321
67314
|
}
|
|
67322
67315
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
@@ -67331,10 +67324,8 @@ function createTypeChecker(host) {
|
|
|
67331
67324
|
void 0,
|
|
67332
67325
|
64 /* UseFullyQualifiedType */
|
|
67333
67326
|
));
|
|
67334
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
67335
|
-
} else {
|
|
67336
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
67337
67327
|
}
|
|
67328
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
67338
67329
|
return false;
|
|
67339
67330
|
}
|
|
67340
67331
|
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */)).value;
|
|
@@ -67343,26 +67334,22 @@ function createTypeChecker(host) {
|
|
|
67343
67334
|
const sourceIsString = typeof sourceValue === "string";
|
|
67344
67335
|
const targetIsString = typeof targetValue === "string";
|
|
67345
67336
|
if (sourceValue !== void 0 && targetValue !== void 0) {
|
|
67346
|
-
if (
|
|
67347
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
67348
|
-
} else {
|
|
67337
|
+
if (errorReporter) {
|
|
67349
67338
|
const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
|
|
67350
67339
|
const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
|
|
67351
67340
|
errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
|
|
67352
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
67353
67341
|
}
|
|
67342
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
67354
67343
|
return false;
|
|
67355
67344
|
}
|
|
67356
67345
|
if (sourceIsString || targetIsString) {
|
|
67357
|
-
if (
|
|
67358
|
-
enumRelation.set(id, 2 /* Failed */);
|
|
67359
|
-
} else {
|
|
67346
|
+
if (errorReporter) {
|
|
67360
67347
|
const knownStringValue = sourceValue ?? targetValue;
|
|
67361
67348
|
Debug.assert(typeof knownStringValue === "string");
|
|
67362
67349
|
const escapedValue = `"${escapeString(knownStringValue)}"`;
|
|
67363
67350
|
errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
|
|
67364
|
-
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
67365
67351
|
}
|
|
67352
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
67366
67353
|
return false;
|
|
67367
67354
|
}
|
|
67368
67355
|
}
|
|
@@ -67520,7 +67507,7 @@ function createTypeChecker(host) {
|
|
|
67520
67507
|
/*ignoreConstraints*/
|
|
67521
67508
|
false
|
|
67522
67509
|
);
|
|
67523
|
-
relation.set(id,
|
|
67510
|
+
relation.set(id, 2 /* Failed */ | (relationCount <= 0 ? 32 /* ComplexityOverflow */ : 64 /* StackDepthOverflow */));
|
|
67524
67511
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
67525
67512
|
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
67526
67513
|
const diag2 = error2(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
@@ -68373,7 +68360,7 @@ function createTypeChecker(host) {
|
|
|
68373
68360
|
);
|
|
68374
68361
|
const entry = relation.get(id);
|
|
68375
68362
|
if (entry !== void 0) {
|
|
68376
|
-
if (reportErrors2 && entry & 2 /* Failed */ && !(entry &
|
|
68363
|
+
if (reportErrors2 && entry & 2 /* Failed */ && !(entry & 96 /* Overflow */)) {
|
|
68377
68364
|
} else {
|
|
68378
68365
|
if (outofbandVarianceMarkerHandler) {
|
|
68379
68366
|
const saved = entry & 24 /* ReportsMask */;
|
|
@@ -68384,6 +68371,11 @@ function createTypeChecker(host) {
|
|
|
68384
68371
|
instantiateType(source2, reportUnreliableMapper);
|
|
68385
68372
|
}
|
|
68386
68373
|
}
|
|
68374
|
+
if (reportErrors2 && entry & 96 /* Overflow */) {
|
|
68375
|
+
const message = entry & 32 /* ComplexityOverflow */ ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
68376
|
+
reportError(message, typeToString(source2), typeToString(target2));
|
|
68377
|
+
overrideNextErrorInfo++;
|
|
68378
|
+
}
|
|
68387
68379
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
68388
68380
|
}
|
|
68389
68381
|
}
|
|
@@ -68481,7 +68473,7 @@ function createTypeChecker(host) {
|
|
|
68481
68473
|
}
|
|
68482
68474
|
}
|
|
68483
68475
|
} else {
|
|
68484
|
-
relation.set(id,
|
|
68476
|
+
relation.set(id, 2 /* Failed */ | propagatingVarianceFlags);
|
|
68485
68477
|
relationCount--;
|
|
68486
68478
|
resetMaybeStack(
|
|
68487
68479
|
/*markAllAsSucceeded*/
|
|
@@ -74517,9 +74509,9 @@ function createTypeChecker(host) {
|
|
|
74517
74509
|
);
|
|
74518
74510
|
}
|
|
74519
74511
|
}
|
|
74520
|
-
function getNarrowedTypeOfSymbol(symbol, location
|
|
74512
|
+
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
74521
74513
|
var _a;
|
|
74522
|
-
const type = getTypeOfSymbol(symbol
|
|
74514
|
+
const type = getTypeOfSymbol(symbol);
|
|
74523
74515
|
const declaration = symbol.valueDeclaration;
|
|
74524
74516
|
if (declaration) {
|
|
74525
74517
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
@@ -74658,7 +74650,10 @@ function createTypeChecker(host) {
|
|
|
74658
74650
|
}
|
|
74659
74651
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
74660
74652
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
74661
|
-
|
|
74653
|
+
if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent2) => parent2 === declaration.parent)) {
|
|
74654
|
+
return nonInferrableAnyType;
|
|
74655
|
+
}
|
|
74656
|
+
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
74662
74657
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
74663
74658
|
if (assignmentKind) {
|
|
74664
74659
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
@@ -76351,7 +76346,7 @@ function createTypeChecker(host) {
|
|
|
76351
76346
|
return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
|
|
76352
76347
|
}
|
|
76353
76348
|
function hasDefaultValue(node) {
|
|
76354
|
-
return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
|
|
76349
|
+
return node.kind === 208 /* BindingElement */ && !!node.initializer || node.kind === 303 /* PropertyAssignment */ && hasDefaultValue(node.initializer) || node.kind === 304 /* ShorthandPropertyAssignment */ && !!node.objectAssignmentInitializer || node.kind === 226 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */;
|
|
76355
76350
|
}
|
|
76356
76351
|
function isSpreadIntoCallOrNew(node) {
|
|
76357
76352
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
@@ -76520,7 +76515,6 @@ function createTypeChecker(host) {
|
|
|
76520
76515
|
return links.immediateTarget;
|
|
76521
76516
|
}
|
|
76522
76517
|
function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
|
|
76523
|
-
var _a;
|
|
76524
76518
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
76525
76519
|
checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
|
|
76526
76520
|
const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0;
|
|
@@ -76575,11 +76569,8 @@ function createTypeChecker(host) {
|
|
|
76575
76569
|
if (nameType) {
|
|
76576
76570
|
prop.links.nameType = nameType;
|
|
76577
76571
|
}
|
|
76578
|
-
if (inDestructuringPattern) {
|
|
76579
|
-
|
|
76580
|
-
if (isOptional) {
|
|
76581
|
-
prop.flags |= 16777216 /* Optional */;
|
|
76582
|
-
}
|
|
76572
|
+
if (inDestructuringPattern && hasDefaultValue(memberDecl)) {
|
|
76573
|
+
prop.flags |= 16777216 /* Optional */;
|
|
76583
76574
|
} else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512 /* ObjectLiteralPatternWithComputedProperties */)) {
|
|
76584
76575
|
const impliedProp = getPropertyOfType(contextualType, member.escapedName);
|
|
76585
76576
|
if (impliedProp) {
|
|
@@ -76654,21 +76645,6 @@ function createTypeChecker(host) {
|
|
|
76654
76645
|
propertiesArray.push(member);
|
|
76655
76646
|
}
|
|
76656
76647
|
popContextualType();
|
|
76657
|
-
if (contextualTypeHasPattern) {
|
|
76658
|
-
const rootPatternParent = findAncestor(contextualType.pattern.parent, (n) => n.kind === 260 /* VariableDeclaration */ || n.kind === 226 /* BinaryExpression */ || n.kind === 169 /* Parameter */);
|
|
76659
|
-
const spreadOrOutsideRootObject = findAncestor(node, (n) => n === rootPatternParent || n.kind === 305 /* SpreadAssignment */);
|
|
76660
|
-
if (spreadOrOutsideRootObject.kind !== 305 /* SpreadAssignment */) {
|
|
76661
|
-
for (const prop of getPropertiesOfType(contextualType)) {
|
|
76662
|
-
if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) {
|
|
76663
|
-
if (!(prop.flags & 16777216 /* Optional */)) {
|
|
76664
|
-
error2(prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
|
|
76665
|
-
}
|
|
76666
|
-
propertiesTable.set(prop.escapedName, prop);
|
|
76667
|
-
propertiesArray.push(prop);
|
|
76668
|
-
}
|
|
76669
|
-
}
|
|
76670
|
-
}
|
|
76671
|
-
}
|
|
76672
76648
|
if (isErrorType(spread)) {
|
|
76673
76649
|
return errorType;
|
|
76674
76650
|
}
|
|
@@ -77191,7 +77167,7 @@ function createTypeChecker(host) {
|
|
|
77191
77167
|
checkGrammarJsxElement(node);
|
|
77192
77168
|
}
|
|
77193
77169
|
checkJsxPreconditions(node);
|
|
77194
|
-
|
|
77170
|
+
markJsxAliasReferenced(node);
|
|
77195
77171
|
if (isNodeOpeningLikeElement) {
|
|
77196
77172
|
const jsxOpeningLikeNode = node;
|
|
77197
77173
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -81946,7 +81922,7 @@ function createTypeChecker(host) {
|
|
|
81946
81922
|
);
|
|
81947
81923
|
}
|
|
81948
81924
|
}
|
|
81949
|
-
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition
|
|
81925
|
+
const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */ | (hasDefaultValue(property) ? 16 /* AllowMissing */ : 0), name);
|
|
81950
81926
|
const type = getFlowTypeOfDestructuring(property, elementType);
|
|
81951
81927
|
return checkDestructuringAssignment(property.kind === 304 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
|
|
81952
81928
|
} else if (property.kind === 305 /* SpreadAssignment */) {
|
|
@@ -81995,7 +81971,7 @@ function createTypeChecker(host) {
|
|
|
81995
81971
|
if (element.kind !== 230 /* SpreadElement */) {
|
|
81996
81972
|
const indexType = getNumberLiteralType(elementIndex);
|
|
81997
81973
|
if (isArrayLikeType(sourceType)) {
|
|
81998
|
-
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /*
|
|
81974
|
+
const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* AllowMissing */ : 0);
|
|
81999
81975
|
const elementType2 = getIndexedAccessTypeOrUndefined(sourceType, indexType, accessFlags, createSyntheticExpression(element, indexType)) || errorType;
|
|
82000
81976
|
const assignedType = hasDefaultValue(element) ? getTypeWithFacts(elementType2, 524288 /* NEUndefined */) : elementType2;
|
|
82001
81977
|
const type = getFlowTypeOfDestructuring(element, assignedType);
|
|
@@ -82834,9 +82810,56 @@ function createTypeChecker(host) {
|
|
|
82834
82810
|
void 0,
|
|
82835
82811
|
checkMode || 0 /* Normal */
|
|
82836
82812
|
) : checkExpressionCached(initializer, checkMode));
|
|
82837
|
-
|
|
82813
|
+
if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
|
|
82814
|
+
if (declaration.name.kind === 206 /* ObjectBindingPattern */ && isObjectLiteralType2(type)) {
|
|
82815
|
+
return padObjectLiteralType(type, declaration.name);
|
|
82816
|
+
}
|
|
82817
|
+
if (declaration.name.kind === 207 /* ArrayBindingPattern */ && isTupleType(type)) {
|
|
82818
|
+
return padTupleType(type, declaration.name);
|
|
82819
|
+
}
|
|
82820
|
+
}
|
|
82821
|
+
return type;
|
|
82822
|
+
}
|
|
82823
|
+
function padObjectLiteralType(type, pattern) {
|
|
82824
|
+
let missingElements;
|
|
82825
|
+
for (const e of pattern.elements) {
|
|
82826
|
+
if (e.initializer) {
|
|
82827
|
+
const name = getPropertyNameFromBindingElement(e);
|
|
82828
|
+
if (name && !getPropertyOfType(type, name)) {
|
|
82829
|
+
missingElements = append(missingElements, e);
|
|
82830
|
+
}
|
|
82831
|
+
}
|
|
82832
|
+
}
|
|
82833
|
+
if (!missingElements) {
|
|
82834
|
+
return type;
|
|
82835
|
+
}
|
|
82836
|
+
const members = createSymbolTable();
|
|
82837
|
+
for (const prop of getPropertiesOfObjectType(type)) {
|
|
82838
|
+
members.set(prop.escapedName, prop);
|
|
82839
|
+
}
|
|
82840
|
+
for (const e of missingElements) {
|
|
82841
|
+
const symbol = createSymbol(4 /* Property */ | 16777216 /* Optional */, getPropertyNameFromBindingElement(e));
|
|
82842
|
+
symbol.links.type = getTypeFromBindingElement(
|
|
82843
|
+
e,
|
|
82844
|
+
/*includePatternInType*/
|
|
82845
|
+
false,
|
|
82846
|
+
/*reportErrors*/
|
|
82847
|
+
false
|
|
82848
|
+
);
|
|
82849
|
+
members.set(symbol.escapedName, symbol);
|
|
82850
|
+
}
|
|
82851
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, getIndexInfosOfType(type));
|
|
82852
|
+
result.objectFlags = type.objectFlags;
|
|
82853
|
+
return result;
|
|
82854
|
+
}
|
|
82855
|
+
function getPropertyNameFromBindingElement(e) {
|
|
82856
|
+
const exprType = getLiteralTypeFromPropertyName(e.propertyName || e.name);
|
|
82857
|
+
return isTypeUsableAsPropertyName(exprType) ? getPropertyNameFromType(exprType) : void 0;
|
|
82838
82858
|
}
|
|
82839
82859
|
function padTupleType(type, pattern) {
|
|
82860
|
+
if (type.target.combinedFlags & 12 /* Variable */ || getTypeReferenceArity(type) >= pattern.elements.length) {
|
|
82861
|
+
return type;
|
|
82862
|
+
}
|
|
82840
82863
|
const patternElements = pattern.elements;
|
|
82841
82864
|
const elementTypes = getElementTypes(type).slice();
|
|
82842
82865
|
const elementFlags = type.target.elementFlags.slice();
|
|
@@ -89993,15 +90016,14 @@ function createTypeChecker(host) {
|
|
|
89993
90016
|
function checkChildIdentifiers(node2) {
|
|
89994
90017
|
forEachNodeRecursively(node2, checkIdentifiers);
|
|
89995
90018
|
}
|
|
90019
|
+
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
|
|
90020
|
+
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
|
|
90021
|
+
}
|
|
89996
90022
|
function checkSingleIdentifier(node2) {
|
|
89997
90023
|
const nodeLinks2 = getNodeLinks(node2);
|
|
89998
90024
|
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
89999
|
-
if (isIdentifier(node2) &&
|
|
90000
|
-
const s =
|
|
90001
|
-
node2,
|
|
90002
|
-
/*ignoreErrors*/
|
|
90003
|
-
true
|
|
90004
|
-
);
|
|
90025
|
+
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
90026
|
+
const s = getResolvedSymbol(node2);
|
|
90005
90027
|
if (s && s !== unknownSymbol) {
|
|
90006
90028
|
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
90007
90029
|
}
|
|
@@ -123967,7 +123989,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
123967
123989
|
const packageJsonLocations = [];
|
|
123968
123990
|
state.failedLookupLocations = packageJsonLocations;
|
|
123969
123991
|
state.affectingLocations = packageJsonLocations;
|
|
123970
|
-
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
123992
|
+
const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
|
|
123971
123993
|
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
123972
123994
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
123973
123995
|
}
|
|
@@ -127911,7 +127933,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
|
|
|
127911
127933
|
}
|
|
127912
127934
|
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
127913
127935
|
const info = repopulateInfo(chain);
|
|
127914
|
-
if (info) {
|
|
127936
|
+
if (info === true) {
|
|
127937
|
+
return {
|
|
127938
|
+
...createModeMismatchDetails(sourceFile),
|
|
127939
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
127940
|
+
};
|
|
127941
|
+
} else if (info) {
|
|
127915
127942
|
return {
|
|
127916
127943
|
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
127917
127944
|
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
@@ -129674,7 +129701,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129674
129701
|
cleanupLibResolutionWatching(newProgram);
|
|
129675
129702
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
129676
129703
|
var _a;
|
|
129677
|
-
const expected =
|
|
129704
|
+
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
129678
129705
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
129679
129706
|
for (let i = existing.length; i < expected; i++) {
|
|
129680
129707
|
createFileWatcherOfAffectingLocation(
|
|
@@ -162041,7 +162068,7 @@ var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code]
|
|
|
162041
162068
|
registerCodeFix({
|
|
162042
162069
|
errorCodes: errorCodes54,
|
|
162043
162070
|
getCodeActions(context) {
|
|
162044
|
-
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
162071
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
|
|
162045
162072
|
if (!info) {
|
|
162046
162073
|
return void 0;
|
|
162047
162074
|
}
|
|
@@ -162050,14 +162077,14 @@ registerCodeFix({
|
|
|
162050
162077
|
},
|
|
162051
162078
|
fixIds: [fixId42],
|
|
162052
162079
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
162053
|
-
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
162080
|
+
const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
|
|
162054
162081
|
if (info) {
|
|
162055
162082
|
doChange35(changes, context.sourceFile, info);
|
|
162056
162083
|
}
|
|
162057
162084
|
})
|
|
162058
162085
|
});
|
|
162059
162086
|
function doChange35(changes, sourceFile, info) {
|
|
162060
|
-
const { allowSyntheticDefaults, defaultImportName, namedImports, statement,
|
|
162087
|
+
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, moduleSpecifier } = info;
|
|
162061
162088
|
changes.replaceNode(
|
|
162062
162089
|
sourceFile,
|
|
162063
162090
|
statement,
|
|
@@ -162067,7 +162094,7 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162067
162094
|
/*isTypeOnly*/
|
|
162068
162095
|
false,
|
|
162069
162096
|
defaultImportName,
|
|
162070
|
-
factory.createExternalModuleReference(
|
|
162097
|
+
factory.createExternalModuleReference(moduleSpecifier)
|
|
162071
162098
|
) : factory.createImportDeclaration(
|
|
162072
162099
|
/*modifiers*/
|
|
162073
162100
|
void 0,
|
|
@@ -162077,13 +162104,13 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162077
162104
|
defaultImportName,
|
|
162078
162105
|
namedImports
|
|
162079
162106
|
),
|
|
162080
|
-
|
|
162107
|
+
moduleSpecifier,
|
|
162081
162108
|
/*attributes*/
|
|
162082
162109
|
void 0
|
|
162083
162110
|
)
|
|
162084
162111
|
);
|
|
162085
162112
|
}
|
|
162086
|
-
function getInfo18(sourceFile, program, pos) {
|
|
162113
|
+
function getInfo18(sourceFile, program, pos, preferences) {
|
|
162087
162114
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
162088
162115
|
if (!isRequireCall(
|
|
162089
162116
|
parent2,
|
|
@@ -162093,15 +162120,17 @@ function getInfo18(sourceFile, program, pos) {
|
|
|
162093
162120
|
Debug.failBadSyntaxKind(parent2);
|
|
162094
162121
|
}
|
|
162095
162122
|
const decl = cast(parent2.parent, isVariableDeclaration);
|
|
162123
|
+
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
162096
162124
|
const defaultImportName = tryCast(decl.name, isIdentifier);
|
|
162097
162125
|
const namedImports = isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0;
|
|
162098
162126
|
if (defaultImportName || namedImports) {
|
|
162127
|
+
const moduleSpecifier = first(parent2.arguments);
|
|
162099
162128
|
return {
|
|
162100
162129
|
allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()),
|
|
162101
162130
|
defaultImportName,
|
|
162102
162131
|
namedImports,
|
|
162103
162132
|
statement: cast(decl.parent.parent, isVariableStatement),
|
|
162104
|
-
|
|
162133
|
+
moduleSpecifier: isNoSubstitutionTemplateLiteral(moduleSpecifier) ? factory.createStringLiteral(moduleSpecifier.text, quotePreference === 0 /* Single */) : moduleSpecifier
|
|
162105
162134
|
};
|
|
162106
162135
|
}
|
|
162107
162136
|
}
|
|
@@ -178866,6 +178895,7 @@ __export(ts_exports2, {
|
|
|
178866
178895
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
178867
178896
|
createModeAwareCache: () => createModeAwareCache,
|
|
178868
178897
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
178898
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
178869
178899
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
178870
178900
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
178871
178901
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -190185,7 +190215,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
190185
190215
|
const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
190186
190216
|
const packageJsonCache = (_a2 = project.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache();
|
|
190187
190217
|
const compilerOptions = project.getCompilationSettings();
|
|
190188
|
-
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory
|
|
190218
|
+
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
190189
190219
|
if (!packageJson) return void 0;
|
|
190190
190220
|
const entrypoints = getEntrypointsFromPackageJsonInfo(
|
|
190191
190221
|
packageJson,
|
|
@@ -193224,6 +193254,7 @@ if (typeof console !== "undefined") {
|
|
|
193224
193254
|
createMemberAccessForPropertyName,
|
|
193225
193255
|
createModeAwareCache,
|
|
193226
193256
|
createModeAwareCacheKey,
|
|
193257
|
+
createModeMismatchDetails,
|
|
193227
193258
|
createModuleNotFoundChain,
|
|
193228
193259
|
createModuleResolutionCache,
|
|
193229
193260
|
createModuleResolutionLoader,
|