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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230203`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -38241,6 +38241,22 @@ ${lanes.join("\n")}
|
|
|
38241
38241
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
38242
38242
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
38243
38243
|
}
|
|
38244
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
38245
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
38246
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
38247
|
+
if (originalPath)
|
|
38248
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
38249
|
+
}
|
|
38250
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
38251
|
+
resolved,
|
|
38252
|
+
isExternalLibraryImport,
|
|
38253
|
+
failedLookupLocations,
|
|
38254
|
+
affectingLocations,
|
|
38255
|
+
diagnostics,
|
|
38256
|
+
state.resultFromCache,
|
|
38257
|
+
legacyResult
|
|
38258
|
+
);
|
|
38259
|
+
}
|
|
38244
38260
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
38245
38261
|
if (resultFromCache) {
|
|
38246
38262
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -38399,6 +38415,15 @@ ${lanes.join("\n")}
|
|
|
38399
38415
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
38400
38416
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
38401
38417
|
}
|
|
38418
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
38419
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
38420
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
38421
|
+
return {
|
|
38422
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
38423
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
38424
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
38425
|
+
};
|
|
38426
|
+
}
|
|
38402
38427
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
38403
38428
|
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.");
|
|
38404
38429
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -38470,13 +38495,13 @@ ${lanes.join("\n")}
|
|
|
38470
38495
|
let resolvedTypeReferenceDirective;
|
|
38471
38496
|
if (resolved) {
|
|
38472
38497
|
const { fileName, packageId } = resolved;
|
|
38473
|
-
|
|
38474
|
-
|
|
38498
|
+
let resolvedFileName = fileName, originalPath;
|
|
38499
|
+
if (!options.preserveSymlinks)
|
|
38500
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
38475
38501
|
resolvedTypeReferenceDirective = {
|
|
38476
38502
|
primary,
|
|
38477
|
-
|
|
38478
|
-
|
|
38479
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
38503
|
+
resolvedFileName,
|
|
38504
|
+
originalPath,
|
|
38480
38505
|
packageId,
|
|
38481
38506
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
38482
38507
|
};
|
|
@@ -39346,13 +39371,14 @@ ${lanes.join("\n")}
|
|
|
39346
39371
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
39347
39372
|
}
|
|
39348
39373
|
}
|
|
39349
|
-
return
|
|
39374
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
39375
|
+
moduleName,
|
|
39350
39376
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
39351
39377
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
39352
39378
|
failedLookupLocations,
|
|
39353
39379
|
affectingLocations,
|
|
39354
39380
|
diagnostics,
|
|
39355
|
-
state
|
|
39381
|
+
state,
|
|
39356
39382
|
legacyResult
|
|
39357
39383
|
);
|
|
39358
39384
|
function tryResolve(extensions2, state2) {
|
|
@@ -39382,16 +39408,7 @@ ${lanes.join("\n")}
|
|
|
39382
39408
|
}
|
|
39383
39409
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39384
39410
|
}
|
|
39385
|
-
|
|
39386
|
-
return void 0;
|
|
39387
|
-
let resolvedValue = resolved2.value;
|
|
39388
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
39389
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
39390
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
39391
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
39392
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
39393
|
-
}
|
|
39394
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
39411
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39395
39412
|
} else {
|
|
39396
39413
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
39397
39414
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -40545,13 +40562,14 @@ ${lanes.join("\n")}
|
|
|
40545
40562
|
candidateIsFromPackageJsonField: false
|
|
40546
40563
|
};
|
|
40547
40564
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
40548
|
-
return
|
|
40565
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
40566
|
+
moduleName,
|
|
40549
40567
|
resolved && resolved.value,
|
|
40550
40568
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
40551
40569
|
failedLookupLocations,
|
|
40552
40570
|
affectingLocations,
|
|
40553
40571
|
diagnostics,
|
|
40554
|
-
state
|
|
40572
|
+
state
|
|
40555
40573
|
);
|
|
40556
40574
|
function tryResolve(extensions) {
|
|
40557
40575
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -46678,7 +46696,12 @@ ${lanes.join("\n")}
|
|
|
46678
46696
|
}
|
|
46679
46697
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
46680
46698
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
46681
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46699
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
46700
|
+
getTypeOfSymbol(exportValue),
|
|
46701
|
+
name,
|
|
46702
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
46703
|
+
true
|
|
46704
|
+
) : moduleSymbol.exports.get(name);
|
|
46682
46705
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
46683
46706
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
46684
46707
|
sourceNode,
|
|
@@ -56093,7 +56116,7 @@ ${lanes.join("\n")}
|
|
|
56093
56116
|
for (const tag of node.tags) {
|
|
56094
56117
|
if (isJSDocOverloadTag(tag)) {
|
|
56095
56118
|
const jsDocSignature = tag.typeExpression;
|
|
56096
|
-
if (jsDocSignature.type === void 0) {
|
|
56119
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
56097
56120
|
reportImplicitAny(jsDocSignature, anyType);
|
|
56098
56121
|
}
|
|
56099
56122
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -56205,6 +56228,12 @@ ${lanes.join("\n")}
|
|
|
56205
56228
|
if (declaration.kind === 173 /* Constructor */) {
|
|
56206
56229
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
56207
56230
|
}
|
|
56231
|
+
if (isJSDocSignature(declaration)) {
|
|
56232
|
+
const root = getJSDocRoot(declaration);
|
|
56233
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
56234
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
56235
|
+
}
|
|
56236
|
+
}
|
|
56208
56237
|
if (isJSDocConstructSignature(declaration)) {
|
|
56209
56238
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
56210
56239
|
}
|
|
@@ -60925,7 +60954,6 @@ ${lanes.join("\n")}
|
|
|
60925
60954
|
let overrideNextErrorInfo = 0;
|
|
60926
60955
|
let lastSkippedInfo;
|
|
60927
60956
|
let incompatibleStack;
|
|
60928
|
-
let inPropertyCheck = false;
|
|
60929
60957
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60930
60958
|
const result = isRelatedTo(
|
|
60931
60959
|
source,
|
|
@@ -61884,14 +61912,15 @@ ${lanes.join("\n")}
|
|
|
61884
61912
|
);
|
|
61885
61913
|
}
|
|
61886
61914
|
}
|
|
61887
|
-
if (result2 && !
|
|
61888
|
-
inPropertyCheck = true;
|
|
61915
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
61889
61916
|
result2 &= propertiesRelatedTo(
|
|
61890
61917
|
source2,
|
|
61891
61918
|
target2,
|
|
61892
61919
|
reportErrors2,
|
|
61893
61920
|
/*excludedProperties*/
|
|
61894
61921
|
void 0,
|
|
61922
|
+
/*optionalsOnly*/
|
|
61923
|
+
false,
|
|
61895
61924
|
0 /* None */
|
|
61896
61925
|
);
|
|
61897
61926
|
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -61904,7 +61933,17 @@ ${lanes.join("\n")}
|
|
|
61904
61933
|
0 /* None */
|
|
61905
61934
|
);
|
|
61906
61935
|
}
|
|
61907
|
-
|
|
61936
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
61937
|
+
result2 &= propertiesRelatedTo(
|
|
61938
|
+
source2,
|
|
61939
|
+
target2,
|
|
61940
|
+
reportErrors2,
|
|
61941
|
+
/*excludedProperties*/
|
|
61942
|
+
void 0,
|
|
61943
|
+
/*optionalsOnly*/
|
|
61944
|
+
true,
|
|
61945
|
+
intersectionState
|
|
61946
|
+
);
|
|
61908
61947
|
}
|
|
61909
61948
|
}
|
|
61910
61949
|
if (result2) {
|
|
@@ -62394,12 +62433,14 @@ ${lanes.join("\n")}
|
|
|
62394
62433
|
reportStructuralErrors,
|
|
62395
62434
|
/*excludedProperties*/
|
|
62396
62435
|
void 0,
|
|
62436
|
+
/*optionalsOnly*/
|
|
62437
|
+
false,
|
|
62397
62438
|
intersectionState
|
|
62398
62439
|
);
|
|
62399
62440
|
if (result2) {
|
|
62400
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
62441
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
62401
62442
|
if (result2) {
|
|
62402
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
62443
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
62403
62444
|
if (result2) {
|
|
62404
62445
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
62405
62446
|
}
|
|
@@ -62528,6 +62569,8 @@ ${lanes.join("\n")}
|
|
|
62528
62569
|
/*reportErrors*/
|
|
62529
62570
|
false,
|
|
62530
62571
|
excludedProperties,
|
|
62572
|
+
/*optionalsOnly*/
|
|
62573
|
+
false,
|
|
62531
62574
|
0 /* None */
|
|
62532
62575
|
);
|
|
62533
62576
|
if (result2) {
|
|
@@ -62536,7 +62579,8 @@ ${lanes.join("\n")}
|
|
|
62536
62579
|
type,
|
|
62537
62580
|
0 /* Call */,
|
|
62538
62581
|
/*reportStructuralErrors*/
|
|
62539
|
-
false
|
|
62582
|
+
false,
|
|
62583
|
+
0 /* None */
|
|
62540
62584
|
);
|
|
62541
62585
|
if (result2) {
|
|
62542
62586
|
result2 &= signaturesRelatedTo(
|
|
@@ -62544,7 +62588,8 @@ ${lanes.join("\n")}
|
|
|
62544
62588
|
type,
|
|
62545
62589
|
1 /* Construct */,
|
|
62546
62590
|
/*reportStructuralErrors*/
|
|
62547
|
-
false
|
|
62591
|
+
false,
|
|
62592
|
+
0 /* None */
|
|
62548
62593
|
);
|
|
62549
62594
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
62550
62595
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -62722,7 +62767,7 @@ ${lanes.join("\n")}
|
|
|
62722
62767
|
}
|
|
62723
62768
|
}
|
|
62724
62769
|
}
|
|
62725
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
62770
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
62726
62771
|
if (relation === identityRelation) {
|
|
62727
62772
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
62728
62773
|
}
|
|
@@ -62858,7 +62903,7 @@ ${lanes.join("\n")}
|
|
|
62858
62903
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
62859
62904
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
62860
62905
|
const name = targetProp.escapedName;
|
|
62861
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
62906
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
62862
62907
|
const sourceProp = getPropertyOfType(source2, name);
|
|
62863
62908
|
if (sourceProp && sourceProp !== targetProp) {
|
|
62864
62909
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -62894,7 +62939,7 @@ ${lanes.join("\n")}
|
|
|
62894
62939
|
}
|
|
62895
62940
|
return result2;
|
|
62896
62941
|
}
|
|
62897
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
62942
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
62898
62943
|
var _a3, _b;
|
|
62899
62944
|
if (relation === identityRelation) {
|
|
62900
62945
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -62931,6 +62976,7 @@ ${lanes.join("\n")}
|
|
|
62931
62976
|
/*erase*/
|
|
62932
62977
|
true,
|
|
62933
62978
|
reportErrors2,
|
|
62979
|
+
intersectionState,
|
|
62934
62980
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
62935
62981
|
);
|
|
62936
62982
|
if (!related) {
|
|
@@ -62942,7 +62988,7 @@ ${lanes.join("\n")}
|
|
|
62942
62988
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
62943
62989
|
const sourceSignature = first(sourceSignatures);
|
|
62944
62990
|
const targetSignature = first(targetSignatures);
|
|
62945
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
62991
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
62946
62992
|
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 */)) {
|
|
62947
62993
|
const constructSignatureToString = (signature) => signatureToString(
|
|
62948
62994
|
signature,
|
|
@@ -62967,6 +63013,7 @@ ${lanes.join("\n")}
|
|
|
62967
63013
|
/*erase*/
|
|
62968
63014
|
true,
|
|
62969
63015
|
shouldElaborateErrors,
|
|
63016
|
+
intersectionState,
|
|
62970
63017
|
incompatibleReporter(s, t)
|
|
62971
63018
|
);
|
|
62972
63019
|
if (related) {
|
|
@@ -63019,7 +63066,7 @@ ${lanes.join("\n")}
|
|
|
63019
63066
|
}
|
|
63020
63067
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
63021
63068
|
}
|
|
63022
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
63069
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63023
63070
|
return compareSignaturesRelated(
|
|
63024
63071
|
erase ? getErasedSignature(source2) : source2,
|
|
63025
63072
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -63027,9 +63074,20 @@ ${lanes.join("\n")}
|
|
|
63027
63074
|
reportErrors2,
|
|
63028
63075
|
reportError,
|
|
63029
63076
|
incompatibleReporter,
|
|
63030
|
-
|
|
63077
|
+
isRelatedToWorker2,
|
|
63031
63078
|
reportUnreliableMapper
|
|
63032
63079
|
);
|
|
63080
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
63081
|
+
return isRelatedTo(
|
|
63082
|
+
source3,
|
|
63083
|
+
target3,
|
|
63084
|
+
3 /* Both */,
|
|
63085
|
+
reportErrors3,
|
|
63086
|
+
/*headMessage*/
|
|
63087
|
+
void 0,
|
|
63088
|
+
intersectionState
|
|
63089
|
+
);
|
|
63090
|
+
}
|
|
63033
63091
|
}
|
|
63034
63092
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
63035
63093
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -63088,7 +63146,7 @@ ${lanes.join("\n")}
|
|
|
63088
63146
|
}
|
|
63089
63147
|
for (const info of getIndexInfosOfType(source2)) {
|
|
63090
63148
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
63091
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
63149
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
63092
63150
|
if (!related) {
|
|
63093
63151
|
return 0 /* False */;
|
|
63094
63152
|
}
|
|
@@ -63097,8 +63155,16 @@ ${lanes.join("\n")}
|
|
|
63097
63155
|
}
|
|
63098
63156
|
return result2;
|
|
63099
63157
|
}
|
|
63100
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
63101
|
-
const related = isRelatedTo(
|
|
63158
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
63159
|
+
const related = isRelatedTo(
|
|
63160
|
+
sourceInfo.type,
|
|
63161
|
+
targetInfo.type,
|
|
63162
|
+
3 /* Both */,
|
|
63163
|
+
reportErrors2,
|
|
63164
|
+
/*headMessage*/
|
|
63165
|
+
void 0,
|
|
63166
|
+
intersectionState
|
|
63167
|
+
);
|
|
63102
63168
|
if (!related && reportErrors2) {
|
|
63103
63169
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
63104
63170
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -63127,7 +63193,7 @@ ${lanes.join("\n")}
|
|
|
63127
63193
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
63128
63194
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
63129
63195
|
if (sourceInfo) {
|
|
63130
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
63196
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
63131
63197
|
}
|
|
63132
63198
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63133
63199
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -63418,12 +63484,15 @@ ${lanes.join("\n")}
|
|
|
63418
63484
|
}
|
|
63419
63485
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
63420
63486
|
if (depth >= maxDepth) {
|
|
63487
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
63488
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
63489
|
+
}
|
|
63421
63490
|
const identity2 = getRecursionIdentity(type);
|
|
63422
63491
|
let count = 0;
|
|
63423
63492
|
let lastTypeId = 0;
|
|
63424
63493
|
for (let i = 0; i < depth; i++) {
|
|
63425
63494
|
const t = stack[i];
|
|
63426
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
63495
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
63427
63496
|
if (t.id >= lastTypeId) {
|
|
63428
63497
|
count++;
|
|
63429
63498
|
if (count >= maxDepth) {
|
|
@@ -72442,7 +72511,7 @@ ${lanes.join("\n")}
|
|
|
72442
72511
|
}
|
|
72443
72512
|
}
|
|
72444
72513
|
function checkCallExpression(node, checkMode) {
|
|
72445
|
-
var _a2;
|
|
72514
|
+
var _a2, _b, _c;
|
|
72446
72515
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
72447
72516
|
const signature = getResolvedSignature(
|
|
72448
72517
|
node,
|
|
@@ -72459,7 +72528,7 @@ ${lanes.join("\n")}
|
|
|
72459
72528
|
}
|
|
72460
72529
|
if (node.kind === 211 /* NewExpression */) {
|
|
72461
72530
|
const declaration = signature.declaration;
|
|
72462
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
72531
|
+
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)) {
|
|
72463
72532
|
if (noImplicitAny) {
|
|
72464
72533
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
72465
72534
|
}
|
|
@@ -72487,7 +72556,7 @@ ${lanes.join("\n")}
|
|
|
72487
72556
|
/*allowDeclaration*/
|
|
72488
72557
|
false
|
|
72489
72558
|
);
|
|
72490
|
-
if ((
|
|
72559
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
72491
72560
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
72492
72561
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
72493
72562
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -84390,8 +84459,8 @@ ${lanes.join("\n")}
|
|
|
84390
84459
|
"use strict";
|
|
84391
84460
|
init_ts2();
|
|
84392
84461
|
init_ts2();
|
|
84393
|
-
init_ts_performance();
|
|
84394
84462
|
init_ts_moduleSpecifiers();
|
|
84463
|
+
init_ts_performance();
|
|
84395
84464
|
ambientModuleSymbolRegex = /^".+"$/;
|
|
84396
84465
|
anon = "(anonymous)";
|
|
84397
84466
|
nextSymbolId = 1;
|
|
@@ -133399,9 +133468,9 @@ ${lanes.join("\n")}
|
|
|
133399
133468
|
"src/services/services.ts"() {
|
|
133400
133469
|
"use strict";
|
|
133401
133470
|
init_ts4();
|
|
133471
|
+
init_ts4();
|
|
133402
133472
|
init_ts_NavigateTo();
|
|
133403
133473
|
init_ts_NavigationBar();
|
|
133404
|
-
init_ts4();
|
|
133405
133474
|
servicesVersion = "0.8";
|
|
133406
133475
|
NodeObject = class {
|
|
133407
133476
|
constructor(kind, pos, end) {
|
|
@@ -136407,8 +136476,8 @@ ${lanes.join("\n")}
|
|
|
136407
136476
|
var init_addEmptyExportDeclaration = __esm({
|
|
136408
136477
|
"src/services/codefixes/addEmptyExportDeclaration.ts"() {
|
|
136409
136478
|
"use strict";
|
|
136410
|
-
init_ts_codefix();
|
|
136411
136479
|
init_ts4();
|
|
136480
|
+
init_ts_codefix();
|
|
136412
136481
|
registerCodeFix({
|
|
136413
136482
|
errorCodes: [
|
|
136414
136483
|
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
|
|
@@ -138772,8 +138841,8 @@ ${lanes.join("\n")}
|
|
|
138772
138841
|
var init_convertToEsModule = __esm({
|
|
138773
138842
|
"src/services/codefixes/convertToEsModule.ts"() {
|
|
138774
138843
|
"use strict";
|
|
138775
|
-
init_ts_codefix();
|
|
138776
138844
|
init_ts4();
|
|
138845
|
+
init_ts_codefix();
|
|
138777
138846
|
registerCodeFix({
|
|
138778
138847
|
errorCodes: [Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module.code],
|
|
138779
138848
|
getCodeActions(context) {
|
|
@@ -142372,8 +142441,8 @@ ${lanes.join("\n")}
|
|
|
142372
142441
|
var init_fixModuleAndTargetOptions = __esm({
|
|
142373
142442
|
"src/services/codefixes/fixModuleAndTargetOptions.ts"() {
|
|
142374
142443
|
"use strict";
|
|
142375
|
-
init_ts_codefix();
|
|
142376
142444
|
init_ts4();
|
|
142445
|
+
init_ts_codefix();
|
|
142377
142446
|
registerCodeFix({
|
|
142378
142447
|
errorCodes: [
|
|
142379
142448
|
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
@@ -147705,7 +147774,7 @@ ${lanes.join("\n")}
|
|
|
147705
147774
|
}
|
|
147706
147775
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
147707
147776
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
147708
|
-
const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
147777
|
+
const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
|
|
147709
147778
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
147710
147779
|
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
147711
147780
|
const importKind = ts_codefix_exports.getImportKind(
|
|
@@ -157705,6 +157774,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157705
157774
|
if (isExpression(body)) {
|
|
157706
157775
|
const returnStatement = factory.createReturnStatement(body);
|
|
157707
157776
|
const file = body.getSourceFile();
|
|
157777
|
+
setTextRange(returnStatement, body);
|
|
157708
157778
|
suppressLeadingAndTrailingTrivia(returnStatement);
|
|
157709
157779
|
copyTrailingAsLeadingComments(
|
|
157710
157780
|
body,
|
|
@@ -164683,8 +164753,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
164683
164753
|
var init_rules = __esm({
|
|
164684
164754
|
"src/services/formatting/rules.ts"() {
|
|
164685
164755
|
"use strict";
|
|
164686
|
-
init_ts_formatting();
|
|
164687
164756
|
init_ts4();
|
|
164757
|
+
init_ts_formatting();
|
|
164688
164758
|
}
|
|
164689
164759
|
});
|
|
164690
164760
|
|
|
@@ -167096,8 +167166,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167096
167166
|
var init_scriptInfo = __esm({
|
|
167097
167167
|
"src/server/scriptInfo.ts"() {
|
|
167098
167168
|
"use strict";
|
|
167099
|
-
init_ts_server2();
|
|
167100
167169
|
init_ts6();
|
|
167170
|
+
init_ts_server2();
|
|
167101
167171
|
TextStorage = class {
|
|
167102
167172
|
constructor(host, info, initialVersion) {
|
|
167103
167173
|
this.host = host;
|
|
@@ -167787,8 +167857,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167787
167857
|
"src/server/project.ts"() {
|
|
167788
167858
|
"use strict";
|
|
167789
167859
|
init_ts6();
|
|
167790
|
-
init_ts_server2();
|
|
167791
167860
|
init_ts6();
|
|
167861
|
+
init_ts_server2();
|
|
167792
167862
|
ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
|
|
167793
167863
|
ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
|
|
167794
167864
|
ProjectKind2[ProjectKind2["Configured"] = 1] = "Configured";
|
|
@@ -170128,8 +170198,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170128
170198
|
var init_editorServices = __esm({
|
|
170129
170199
|
"src/server/editorServices.ts"() {
|
|
170130
170200
|
"use strict";
|
|
170131
|
-
init_ts_server2();
|
|
170132
170201
|
init_ts6();
|
|
170202
|
+
init_ts_server2();
|
|
170133
170203
|
maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
|
|
170134
170204
|
maxFileSize = 4 * 1024 * 1024;
|
|
170135
170205
|
ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
|