typescript 5.0.0-dev.20230202 → 5.0.0-dev.20230203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +113 -44
- package/lib/tsserver.js +2854 -2784
- package/lib/tsserverlibrary.js +124 -54
- package/lib/typescript.js +121 -51
- package/lib/typingsInstaller.js +33 -15
- package/package.json +2 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230203`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -35955,6 +35955,22 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
35955
35955
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
35956
35956
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
35957
35957
|
}
|
|
35958
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
35959
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
35960
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
35961
|
+
if (originalPath)
|
|
35962
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
35963
|
+
}
|
|
35964
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
35965
|
+
resolved,
|
|
35966
|
+
isExternalLibraryImport,
|
|
35967
|
+
failedLookupLocations,
|
|
35968
|
+
affectingLocations,
|
|
35969
|
+
diagnostics,
|
|
35970
|
+
state.resultFromCache,
|
|
35971
|
+
legacyResult
|
|
35972
|
+
);
|
|
35973
|
+
}
|
|
35958
35974
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
35959
35975
|
if (resultFromCache) {
|
|
35960
35976
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -36115,6 +36131,15 @@ function arePathsEqual(path1, path2, host) {
|
|
|
36115
36131
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
36116
36132
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
36117
36133
|
}
|
|
36134
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
36135
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
36136
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
36137
|
+
return {
|
|
36138
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
36139
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
36140
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
36141
|
+
};
|
|
36142
|
+
}
|
|
36118
36143
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
36119
36144
|
Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
|
|
36120
36145
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -36186,13 +36211,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
36186
36211
|
let resolvedTypeReferenceDirective;
|
|
36187
36212
|
if (resolved) {
|
|
36188
36213
|
const { fileName, packageId } = resolved;
|
|
36189
|
-
|
|
36190
|
-
|
|
36214
|
+
let resolvedFileName = fileName, originalPath;
|
|
36215
|
+
if (!options.preserveSymlinks)
|
|
36216
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
36191
36217
|
resolvedTypeReferenceDirective = {
|
|
36192
36218
|
primary,
|
|
36193
|
-
|
|
36194
|
-
|
|
36195
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
36219
|
+
resolvedFileName,
|
|
36220
|
+
originalPath,
|
|
36196
36221
|
packageId,
|
|
36197
36222
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
36198
36223
|
};
|
|
@@ -37050,13 +37075,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37050
37075
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
37051
37076
|
}
|
|
37052
37077
|
}
|
|
37053
|
-
return
|
|
37078
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
37079
|
+
moduleName,
|
|
37054
37080
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
37055
37081
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
37056
37082
|
failedLookupLocations,
|
|
37057
37083
|
affectingLocations,
|
|
37058
37084
|
diagnostics,
|
|
37059
|
-
state
|
|
37085
|
+
state,
|
|
37060
37086
|
legacyResult
|
|
37061
37087
|
);
|
|
37062
37088
|
function tryResolve(extensions2, state2) {
|
|
@@ -37086,16 +37112,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37086
37112
|
}
|
|
37087
37113
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
37088
37114
|
}
|
|
37089
|
-
|
|
37090
|
-
return void 0;
|
|
37091
|
-
let resolvedValue = resolved2.value;
|
|
37092
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
37093
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
37094
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
37095
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
37096
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
37097
|
-
}
|
|
37098
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
37115
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
37099
37116
|
} else {
|
|
37100
37117
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
37101
37118
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -38150,13 +38167,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
38150
38167
|
candidateIsFromPackageJsonField: false
|
|
38151
38168
|
};
|
|
38152
38169
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
38153
|
-
return
|
|
38170
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
38171
|
+
moduleName,
|
|
38154
38172
|
resolved && resolved.value,
|
|
38155
38173
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
38156
38174
|
failedLookupLocations,
|
|
38157
38175
|
affectingLocations,
|
|
38158
38176
|
diagnostics,
|
|
38159
|
-
state
|
|
38177
|
+
state
|
|
38160
38178
|
);
|
|
38161
38179
|
function tryResolve(extensions) {
|
|
38162
38180
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -44304,7 +44322,12 @@ function createTypeChecker(host) {
|
|
|
44304
44322
|
}
|
|
44305
44323
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
44306
44324
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
44307
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
44325
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
44326
|
+
getTypeOfSymbol(exportValue),
|
|
44327
|
+
name,
|
|
44328
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
44329
|
+
true
|
|
44330
|
+
) : moduleSymbol.exports.get(name);
|
|
44308
44331
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
44309
44332
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
44310
44333
|
sourceNode,
|
|
@@ -53719,7 +53742,7 @@ function createTypeChecker(host) {
|
|
|
53719
53742
|
for (const tag of node.tags) {
|
|
53720
53743
|
if (isJSDocOverloadTag(tag)) {
|
|
53721
53744
|
const jsDocSignature = tag.typeExpression;
|
|
53722
|
-
if (jsDocSignature.type === void 0) {
|
|
53745
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
53723
53746
|
reportImplicitAny(jsDocSignature, anyType);
|
|
53724
53747
|
}
|
|
53725
53748
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -53831,6 +53854,12 @@ function createTypeChecker(host) {
|
|
|
53831
53854
|
if (declaration.kind === 173 /* Constructor */) {
|
|
53832
53855
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
53833
53856
|
}
|
|
53857
|
+
if (isJSDocSignature(declaration)) {
|
|
53858
|
+
const root = getJSDocRoot(declaration);
|
|
53859
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
53860
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
53861
|
+
}
|
|
53862
|
+
}
|
|
53834
53863
|
if (isJSDocConstructSignature(declaration)) {
|
|
53835
53864
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
53836
53865
|
}
|
|
@@ -58551,7 +58580,6 @@ function createTypeChecker(host) {
|
|
|
58551
58580
|
let overrideNextErrorInfo = 0;
|
|
58552
58581
|
let lastSkippedInfo;
|
|
58553
58582
|
let incompatibleStack;
|
|
58554
|
-
let inPropertyCheck = false;
|
|
58555
58583
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
58556
58584
|
const result = isRelatedTo(
|
|
58557
58585
|
source,
|
|
@@ -59510,14 +59538,15 @@ function createTypeChecker(host) {
|
|
|
59510
59538
|
);
|
|
59511
59539
|
}
|
|
59512
59540
|
}
|
|
59513
|
-
if (result2 && !
|
|
59514
|
-
inPropertyCheck = true;
|
|
59541
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
59515
59542
|
result2 &= propertiesRelatedTo(
|
|
59516
59543
|
source2,
|
|
59517
59544
|
target2,
|
|
59518
59545
|
reportErrors2,
|
|
59519
59546
|
/*excludedProperties*/
|
|
59520
59547
|
void 0,
|
|
59548
|
+
/*optionalsOnly*/
|
|
59549
|
+
false,
|
|
59521
59550
|
0 /* None */
|
|
59522
59551
|
);
|
|
59523
59552
|
if (result2 && isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -59530,7 +59559,17 @@ function createTypeChecker(host) {
|
|
|
59530
59559
|
0 /* None */
|
|
59531
59560
|
);
|
|
59532
59561
|
}
|
|
59533
|
-
|
|
59562
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
59563
|
+
result2 &= propertiesRelatedTo(
|
|
59564
|
+
source2,
|
|
59565
|
+
target2,
|
|
59566
|
+
reportErrors2,
|
|
59567
|
+
/*excludedProperties*/
|
|
59568
|
+
void 0,
|
|
59569
|
+
/*optionalsOnly*/
|
|
59570
|
+
true,
|
|
59571
|
+
intersectionState
|
|
59572
|
+
);
|
|
59534
59573
|
}
|
|
59535
59574
|
}
|
|
59536
59575
|
if (result2) {
|
|
@@ -60020,12 +60059,14 @@ function createTypeChecker(host) {
|
|
|
60020
60059
|
reportStructuralErrors,
|
|
60021
60060
|
/*excludedProperties*/
|
|
60022
60061
|
void 0,
|
|
60062
|
+
/*optionalsOnly*/
|
|
60063
|
+
false,
|
|
60023
60064
|
intersectionState
|
|
60024
60065
|
);
|
|
60025
60066
|
if (result2) {
|
|
60026
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
60067
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
60027
60068
|
if (result2) {
|
|
60028
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
60069
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
60029
60070
|
if (result2) {
|
|
60030
60071
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
60031
60072
|
}
|
|
@@ -60154,6 +60195,8 @@ function createTypeChecker(host) {
|
|
|
60154
60195
|
/*reportErrors*/
|
|
60155
60196
|
false,
|
|
60156
60197
|
excludedProperties,
|
|
60198
|
+
/*optionalsOnly*/
|
|
60199
|
+
false,
|
|
60157
60200
|
0 /* None */
|
|
60158
60201
|
);
|
|
60159
60202
|
if (result2) {
|
|
@@ -60162,7 +60205,8 @@ function createTypeChecker(host) {
|
|
|
60162
60205
|
type,
|
|
60163
60206
|
0 /* Call */,
|
|
60164
60207
|
/*reportStructuralErrors*/
|
|
60165
|
-
false
|
|
60208
|
+
false,
|
|
60209
|
+
0 /* None */
|
|
60166
60210
|
);
|
|
60167
60211
|
if (result2) {
|
|
60168
60212
|
result2 &= signaturesRelatedTo(
|
|
@@ -60170,7 +60214,8 @@ function createTypeChecker(host) {
|
|
|
60170
60214
|
type,
|
|
60171
60215
|
1 /* Construct */,
|
|
60172
60216
|
/*reportStructuralErrors*/
|
|
60173
|
-
false
|
|
60217
|
+
false,
|
|
60218
|
+
0 /* None */
|
|
60174
60219
|
);
|
|
60175
60220
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
60176
60221
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -60348,7 +60393,7 @@ function createTypeChecker(host) {
|
|
|
60348
60393
|
}
|
|
60349
60394
|
}
|
|
60350
60395
|
}
|
|
60351
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
60396
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
60352
60397
|
if (relation === identityRelation) {
|
|
60353
60398
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
60354
60399
|
}
|
|
@@ -60484,7 +60529,7 @@ function createTypeChecker(host) {
|
|
|
60484
60529
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
60485
60530
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
60486
60531
|
const name = targetProp.escapedName;
|
|
60487
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
60532
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
60488
60533
|
const sourceProp = getPropertyOfType(source2, name);
|
|
60489
60534
|
if (sourceProp && sourceProp !== targetProp) {
|
|
60490
60535
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -60520,7 +60565,7 @@ function createTypeChecker(host) {
|
|
|
60520
60565
|
}
|
|
60521
60566
|
return result2;
|
|
60522
60567
|
}
|
|
60523
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
60568
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
60524
60569
|
var _a3, _b;
|
|
60525
60570
|
if (relation === identityRelation) {
|
|
60526
60571
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -60557,6 +60602,7 @@ function createTypeChecker(host) {
|
|
|
60557
60602
|
/*erase*/
|
|
60558
60603
|
true,
|
|
60559
60604
|
reportErrors2,
|
|
60605
|
+
intersectionState,
|
|
60560
60606
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
60561
60607
|
);
|
|
60562
60608
|
if (!related) {
|
|
@@ -60568,7 +60614,7 @@ function createTypeChecker(host) {
|
|
|
60568
60614
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
60569
60615
|
const sourceSignature = first(sourceSignatures);
|
|
60570
60616
|
const targetSignature = first(targetSignatures);
|
|
60571
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
60617
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
60572
60618
|
if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) {
|
|
60573
60619
|
const constructSignatureToString = (signature) => signatureToString(
|
|
60574
60620
|
signature,
|
|
@@ -60593,6 +60639,7 @@ function createTypeChecker(host) {
|
|
|
60593
60639
|
/*erase*/
|
|
60594
60640
|
true,
|
|
60595
60641
|
shouldElaborateErrors,
|
|
60642
|
+
intersectionState,
|
|
60596
60643
|
incompatibleReporter(s, t)
|
|
60597
60644
|
);
|
|
60598
60645
|
if (related) {
|
|
@@ -60645,7 +60692,7 @@ function createTypeChecker(host) {
|
|
|
60645
60692
|
}
|
|
60646
60693
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
60647
60694
|
}
|
|
60648
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
60695
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
60649
60696
|
return compareSignaturesRelated(
|
|
60650
60697
|
erase ? getErasedSignature(source2) : source2,
|
|
60651
60698
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -60653,9 +60700,20 @@ function createTypeChecker(host) {
|
|
|
60653
60700
|
reportErrors2,
|
|
60654
60701
|
reportError,
|
|
60655
60702
|
incompatibleReporter,
|
|
60656
|
-
|
|
60703
|
+
isRelatedToWorker2,
|
|
60657
60704
|
reportUnreliableMapper
|
|
60658
60705
|
);
|
|
60706
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
60707
|
+
return isRelatedTo(
|
|
60708
|
+
source3,
|
|
60709
|
+
target3,
|
|
60710
|
+
3 /* Both */,
|
|
60711
|
+
reportErrors3,
|
|
60712
|
+
/*headMessage*/
|
|
60713
|
+
void 0,
|
|
60714
|
+
intersectionState
|
|
60715
|
+
);
|
|
60716
|
+
}
|
|
60659
60717
|
}
|
|
60660
60718
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
60661
60719
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -60714,7 +60772,7 @@ function createTypeChecker(host) {
|
|
|
60714
60772
|
}
|
|
60715
60773
|
for (const info of getIndexInfosOfType(source2)) {
|
|
60716
60774
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
60717
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
60775
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
60718
60776
|
if (!related) {
|
|
60719
60777
|
return 0 /* False */;
|
|
60720
60778
|
}
|
|
@@ -60723,8 +60781,16 @@ function createTypeChecker(host) {
|
|
|
60723
60781
|
}
|
|
60724
60782
|
return result2;
|
|
60725
60783
|
}
|
|
60726
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
60727
|
-
const related = isRelatedTo(
|
|
60784
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
60785
|
+
const related = isRelatedTo(
|
|
60786
|
+
sourceInfo.type,
|
|
60787
|
+
targetInfo.type,
|
|
60788
|
+
3 /* Both */,
|
|
60789
|
+
reportErrors2,
|
|
60790
|
+
/*headMessage*/
|
|
60791
|
+
void 0,
|
|
60792
|
+
intersectionState
|
|
60793
|
+
);
|
|
60728
60794
|
if (!related && reportErrors2) {
|
|
60729
60795
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
60730
60796
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -60753,7 +60819,7 @@ function createTypeChecker(host) {
|
|
|
60753
60819
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
60754
60820
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
60755
60821
|
if (sourceInfo) {
|
|
60756
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
60822
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
60757
60823
|
}
|
|
60758
60824
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
60759
60825
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -61044,12 +61110,15 @@ function createTypeChecker(host) {
|
|
|
61044
61110
|
}
|
|
61045
61111
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
61046
61112
|
if (depth >= maxDepth) {
|
|
61113
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
61114
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
61115
|
+
}
|
|
61047
61116
|
const identity2 = getRecursionIdentity(type);
|
|
61048
61117
|
let count = 0;
|
|
61049
61118
|
let lastTypeId = 0;
|
|
61050
61119
|
for (let i = 0; i < depth; i++) {
|
|
61051
61120
|
const t = stack[i];
|
|
61052
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
61121
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
61053
61122
|
if (t.id >= lastTypeId) {
|
|
61054
61123
|
count++;
|
|
61055
61124
|
if (count >= maxDepth) {
|
|
@@ -70068,7 +70137,7 @@ function createTypeChecker(host) {
|
|
|
70068
70137
|
}
|
|
70069
70138
|
}
|
|
70070
70139
|
function checkCallExpression(node, checkMode) {
|
|
70071
|
-
var _a2;
|
|
70140
|
+
var _a2, _b, _c;
|
|
70072
70141
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
70073
70142
|
const signature = getResolvedSignature(
|
|
70074
70143
|
node,
|
|
@@ -70085,7 +70154,7 @@ function createTypeChecker(host) {
|
|
|
70085
70154
|
}
|
|
70086
70155
|
if (node.kind === 211 /* NewExpression */) {
|
|
70087
70156
|
const declaration = signature.declaration;
|
|
70088
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
70157
|
+
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
70089
70158
|
if (noImplicitAny) {
|
|
70090
70159
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
70091
70160
|
}
|
|
@@ -70113,7 +70182,7 @@ function createTypeChecker(host) {
|
|
|
70113
70182
|
/*allowDeclaration*/
|
|
70114
70183
|
false
|
|
70115
70184
|
);
|
|
70116
|
-
if ((
|
|
70185
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
70117
70186
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
70118
70187
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
70119
70188
|
return getIntersectionType([returnType, jsAssignmentType]);
|