@typescript-deploys/pr-build 5.0.0-pr-52059-5 → 5.0.0-pr-52577-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +122 -50
- package/lib/tsserver.js +135 -56
- package/lib/tsserverlibrary.d.ts +16 -0
- package/lib/tsserverlibrary.js +135 -56
- package/lib/typescript.d.ts +16 -0
- package/lib/typescript.js +135 -56
- package/lib/typingsInstaller.js +33 -15
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -2378,7 +2378,7 @@ __export(ts_server_exports3, {
|
|
|
2378
2378
|
|
|
2379
2379
|
// src/compiler/corePublic.ts
|
|
2380
2380
|
var versionMajorMinor = "5.0";
|
|
2381
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2381
|
+
var version = `${versionMajorMinor}.0-insiders.20230202`;
|
|
2382
2382
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2383
2383
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2384
2384
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -40430,6 +40430,22 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
40430
40430
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
40431
40431
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
40432
40432
|
}
|
|
40433
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
|
|
40434
|
+
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
40435
|
+
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
40436
|
+
if (originalPath)
|
|
40437
|
+
resolved = { ...resolved, path: resolvedFileName, originalPath };
|
|
40438
|
+
}
|
|
40439
|
+
return createResolvedModuleWithFailedLookupLocations(
|
|
40440
|
+
resolved,
|
|
40441
|
+
isExternalLibraryImport,
|
|
40442
|
+
failedLookupLocations,
|
|
40443
|
+
affectingLocations,
|
|
40444
|
+
diagnostics,
|
|
40445
|
+
state.resultFromCache,
|
|
40446
|
+
legacyResult
|
|
40447
|
+
);
|
|
40448
|
+
}
|
|
40433
40449
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
|
|
40434
40450
|
if (resultFromCache) {
|
|
40435
40451
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -40590,6 +40606,15 @@ function arePathsEqual(path1, path2, host) {
|
|
|
40590
40606
|
const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
|
|
40591
40607
|
return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
|
|
40592
40608
|
}
|
|
40609
|
+
function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
|
|
40610
|
+
const resolvedFileName = realPath(fileName, host, traceEnabled);
|
|
40611
|
+
const pathsAreEqual = arePathsEqual(fileName, resolvedFileName, host);
|
|
40612
|
+
return {
|
|
40613
|
+
// If the fileName and realpath are differing only in casing prefer fileName so that we can issue correct errors for casing under forceConsistentCasingInFileNames
|
|
40614
|
+
resolvedFileName: pathsAreEqual ? fileName : resolvedFileName,
|
|
40615
|
+
originalPath: pathsAreEqual ? void 0 : fileName
|
|
40616
|
+
};
|
|
40617
|
+
}
|
|
40593
40618
|
function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) {
|
|
40594
40619
|
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.");
|
|
40595
40620
|
const traceEnabled = isTraceEnabled(options, host);
|
|
@@ -40661,13 +40686,13 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
40661
40686
|
let resolvedTypeReferenceDirective;
|
|
40662
40687
|
if (resolved) {
|
|
40663
40688
|
const { fileName, packageId } = resolved;
|
|
40664
|
-
|
|
40665
|
-
|
|
40689
|
+
let resolvedFileName = fileName, originalPath;
|
|
40690
|
+
if (!options.preserveSymlinks)
|
|
40691
|
+
({ resolvedFileName, originalPath } = getOriginalAndResolvedFileName(fileName, host, traceEnabled));
|
|
40666
40692
|
resolvedTypeReferenceDirective = {
|
|
40667
40693
|
primary,
|
|
40668
|
-
|
|
40669
|
-
|
|
40670
|
-
originalPath: pathsAreEqual ? void 0 : fileName,
|
|
40694
|
+
resolvedFileName,
|
|
40695
|
+
originalPath,
|
|
40671
40696
|
packageId,
|
|
40672
40697
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
40673
40698
|
};
|
|
@@ -41550,13 +41575,14 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41550
41575
|
legacyResult = diagnosticResult.value.resolved.path;
|
|
41551
41576
|
}
|
|
41552
41577
|
}
|
|
41553
|
-
return
|
|
41578
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
41579
|
+
moduleName,
|
|
41554
41580
|
(_c = result == null ? void 0 : result.value) == null ? void 0 : _c.resolved,
|
|
41555
41581
|
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.isExternalLibraryImport,
|
|
41556
41582
|
failedLookupLocations,
|
|
41557
41583
|
affectingLocations,
|
|
41558
41584
|
diagnostics,
|
|
41559
|
-
state
|
|
41585
|
+
state,
|
|
41560
41586
|
legacyResult
|
|
41561
41587
|
);
|
|
41562
41588
|
function tryResolve(extensions2, state2) {
|
|
@@ -41586,16 +41612,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
41586
41612
|
}
|
|
41587
41613
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
41588
41614
|
}
|
|
41589
|
-
|
|
41590
|
-
return void 0;
|
|
41591
|
-
let resolvedValue = resolved2.value;
|
|
41592
|
-
if (!compilerOptions.preserveSymlinks && resolvedValue && !resolvedValue.originalPath) {
|
|
41593
|
-
const path = realPath(resolvedValue.path, host, traceEnabled);
|
|
41594
|
-
const pathsAreEqual = arePathsEqual(path, resolvedValue.path, host);
|
|
41595
|
-
const originalPath = pathsAreEqual ? void 0 : resolvedValue.path;
|
|
41596
|
-
resolvedValue = { ...resolvedValue, path: pathsAreEqual ? resolvedValue.path : path, originalPath };
|
|
41597
|
-
}
|
|
41598
|
-
return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } };
|
|
41615
|
+
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
41599
41616
|
} else {
|
|
41600
41617
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
41601
41618
|
const resolved2 = nodeLoadModuleByRelativeName(
|
|
@@ -42751,13 +42768,14 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
42751
42768
|
candidateIsFromPackageJsonField: false
|
|
42752
42769
|
};
|
|
42753
42770
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
42754
|
-
return
|
|
42771
|
+
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
42772
|
+
moduleName,
|
|
42755
42773
|
resolved && resolved.value,
|
|
42756
42774
|
(resolved == null ? void 0 : resolved.value) && pathContainsNodeModules(resolved.value.path),
|
|
42757
42775
|
failedLookupLocations,
|
|
42758
42776
|
affectingLocations,
|
|
42759
42777
|
diagnostics,
|
|
42760
|
-
state
|
|
42778
|
+
state
|
|
42761
42779
|
);
|
|
42762
42780
|
function tryResolve(extensions) {
|
|
42763
42781
|
const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -48959,7 +48977,12 @@ function createTypeChecker(host) {
|
|
|
48959
48977
|
}
|
|
48960
48978
|
function resolveExportByName(moduleSymbol, name, sourceNode, dontResolveAlias) {
|
|
48961
48979
|
const exportValue = moduleSymbol.exports.get("export=" /* ExportEquals */);
|
|
48962
|
-
const exportSymbol = exportValue ? getPropertyOfType(
|
|
48980
|
+
const exportSymbol = exportValue ? getPropertyOfType(
|
|
48981
|
+
getTypeOfSymbol(exportValue),
|
|
48982
|
+
name,
|
|
48983
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
48984
|
+
true
|
|
48985
|
+
) : moduleSymbol.exports.get(name);
|
|
48963
48986
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
48964
48987
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
48965
48988
|
sourceNode,
|
|
@@ -58374,7 +58397,7 @@ function createTypeChecker(host) {
|
|
|
58374
58397
|
for (const tag of node.tags) {
|
|
58375
58398
|
if (isJSDocOverloadTag(tag)) {
|
|
58376
58399
|
const jsDocSignature = tag.typeExpression;
|
|
58377
|
-
if (jsDocSignature.type === void 0) {
|
|
58400
|
+
if (jsDocSignature.type === void 0 && !isConstructorDeclaration(decl)) {
|
|
58378
58401
|
reportImplicitAny(jsDocSignature, anyType);
|
|
58379
58402
|
}
|
|
58380
58403
|
result.push(getSignatureFromDeclaration(jsDocSignature));
|
|
@@ -58486,6 +58509,12 @@ function createTypeChecker(host) {
|
|
|
58486
58509
|
if (declaration.kind === 173 /* Constructor */) {
|
|
58487
58510
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
58488
58511
|
}
|
|
58512
|
+
if (isJSDocSignature(declaration)) {
|
|
58513
|
+
const root = getJSDocRoot(declaration);
|
|
58514
|
+
if (root && isConstructorDeclaration(root.parent)) {
|
|
58515
|
+
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
58516
|
+
}
|
|
58517
|
+
}
|
|
58489
58518
|
if (isJSDocConstructSignature(declaration)) {
|
|
58490
58519
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
58491
58520
|
}
|
|
@@ -60076,7 +60105,7 @@ function createTypeChecker(host) {
|
|
|
60076
60105
|
function typePredicateKindsMatch(a, b) {
|
|
60077
60106
|
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
|
|
60078
60107
|
}
|
|
60079
|
-
function getUnionTypeFromSortedList(types,
|
|
60108
|
+
function getUnionTypeFromSortedList(types, precomputedObjectFlags, aliasSymbol, aliasTypeArguments, origin) {
|
|
60080
60109
|
if (types.length === 0) {
|
|
60081
60110
|
return neverType;
|
|
60082
60111
|
}
|
|
@@ -60088,7 +60117,7 @@ function createTypeChecker(host) {
|
|
|
60088
60117
|
let type = unionTypes.get(id);
|
|
60089
60118
|
if (!type) {
|
|
60090
60119
|
type = createType(1048576 /* Union */);
|
|
60091
|
-
type.objectFlags =
|
|
60120
|
+
type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(
|
|
60092
60121
|
types,
|
|
60093
60122
|
/*excludeKinds*/
|
|
60094
60123
|
98304 /* Nullable */
|
|
@@ -63206,7 +63235,6 @@ function createTypeChecker(host) {
|
|
|
63206
63235
|
let overrideNextErrorInfo = 0;
|
|
63207
63236
|
let lastSkippedInfo;
|
|
63208
63237
|
let incompatibleStack;
|
|
63209
|
-
let inPropertyCheck = false;
|
|
63210
63238
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
63211
63239
|
const result = isRelatedTo(
|
|
63212
63240
|
source,
|
|
@@ -64165,14 +64193,15 @@ function createTypeChecker(host) {
|
|
|
64165
64193
|
);
|
|
64166
64194
|
}
|
|
64167
64195
|
}
|
|
64168
|
-
if (result2 && !
|
|
64169
|
-
inPropertyCheck = true;
|
|
64196
|
+
if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) {
|
|
64170
64197
|
result2 &= propertiesRelatedTo(
|
|
64171
64198
|
source2,
|
|
64172
64199
|
target2,
|
|
64173
64200
|
reportErrors2,
|
|
64174
64201
|
/*excludedProperties*/
|
|
64175
64202
|
void 0,
|
|
64203
|
+
/*optionalsOnly*/
|
|
64204
|
+
false,
|
|
64176
64205
|
0 /* None */
|
|
64177
64206
|
);
|
|
64178
64207
|
if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */) {
|
|
@@ -64185,7 +64214,17 @@ function createTypeChecker(host) {
|
|
|
64185
64214
|
0 /* None */
|
|
64186
64215
|
);
|
|
64187
64216
|
}
|
|
64188
|
-
|
|
64217
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
64218
|
+
result2 &= propertiesRelatedTo(
|
|
64219
|
+
source2,
|
|
64220
|
+
target2,
|
|
64221
|
+
reportErrors2,
|
|
64222
|
+
/*excludedProperties*/
|
|
64223
|
+
void 0,
|
|
64224
|
+
/*optionalsOnly*/
|
|
64225
|
+
true,
|
|
64226
|
+
intersectionState
|
|
64227
|
+
);
|
|
64189
64228
|
}
|
|
64190
64229
|
}
|
|
64191
64230
|
if (result2) {
|
|
@@ -64675,12 +64714,14 @@ function createTypeChecker(host) {
|
|
|
64675
64714
|
reportStructuralErrors,
|
|
64676
64715
|
/*excludedProperties*/
|
|
64677
64716
|
void 0,
|
|
64717
|
+
/*optionalsOnly*/
|
|
64718
|
+
false,
|
|
64678
64719
|
intersectionState
|
|
64679
64720
|
);
|
|
64680
64721
|
if (result2) {
|
|
64681
|
-
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors);
|
|
64722
|
+
result2 &= signaturesRelatedTo(source2, target2, 0 /* Call */, reportStructuralErrors, intersectionState);
|
|
64682
64723
|
if (result2) {
|
|
64683
|
-
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors);
|
|
64724
|
+
result2 &= signaturesRelatedTo(source2, target2, 1 /* Construct */, reportStructuralErrors, intersectionState);
|
|
64684
64725
|
if (result2) {
|
|
64685
64726
|
result2 &= indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportStructuralErrors, intersectionState);
|
|
64686
64727
|
}
|
|
@@ -64809,6 +64850,8 @@ function createTypeChecker(host) {
|
|
|
64809
64850
|
/*reportErrors*/
|
|
64810
64851
|
false,
|
|
64811
64852
|
excludedProperties,
|
|
64853
|
+
/*optionalsOnly*/
|
|
64854
|
+
false,
|
|
64812
64855
|
0 /* None */
|
|
64813
64856
|
);
|
|
64814
64857
|
if (result2) {
|
|
@@ -64817,7 +64860,8 @@ function createTypeChecker(host) {
|
|
|
64817
64860
|
type,
|
|
64818
64861
|
0 /* Call */,
|
|
64819
64862
|
/*reportStructuralErrors*/
|
|
64820
|
-
false
|
|
64863
|
+
false,
|
|
64864
|
+
0 /* None */
|
|
64821
64865
|
);
|
|
64822
64866
|
if (result2) {
|
|
64823
64867
|
result2 &= signaturesRelatedTo(
|
|
@@ -64825,7 +64869,8 @@ function createTypeChecker(host) {
|
|
|
64825
64869
|
type,
|
|
64826
64870
|
1 /* Construct */,
|
|
64827
64871
|
/*reportStructuralErrors*/
|
|
64828
|
-
false
|
|
64872
|
+
false,
|
|
64873
|
+
0 /* None */
|
|
64829
64874
|
);
|
|
64830
64875
|
if (result2 && !(isTupleType(source2) && isTupleType(type))) {
|
|
64831
64876
|
result2 &= indexSignaturesRelatedTo(
|
|
@@ -65003,7 +65048,7 @@ function createTypeChecker(host) {
|
|
|
65003
65048
|
}
|
|
65004
65049
|
}
|
|
65005
65050
|
}
|
|
65006
|
-
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, intersectionState) {
|
|
65051
|
+
function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
|
|
65007
65052
|
if (relation === identityRelation) {
|
|
65008
65053
|
return propertiesIdenticalTo(source2, target2, excludedProperties);
|
|
65009
65054
|
}
|
|
@@ -65139,7 +65184,7 @@ function createTypeChecker(host) {
|
|
|
65139
65184
|
const numericNamesOnly = isTupleType(source2) && isTupleType(target2);
|
|
65140
65185
|
for (const targetProp of excludeProperties(properties, excludedProperties)) {
|
|
65141
65186
|
const name = targetProp.escapedName;
|
|
65142
|
-
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length")) {
|
|
65187
|
+
if (!(targetProp.flags & 4194304 /* Prototype */) && (!numericNamesOnly || isNumericLiteralName(name) || name === "length") && (!optionalsOnly || targetProp.flags & 16777216 /* Optional */)) {
|
|
65143
65188
|
const sourceProp = getPropertyOfType(source2, name);
|
|
65144
65189
|
if (sourceProp && sourceProp !== targetProp) {
|
|
65145
65190
|
const related = propertyRelatedTo(source2, target2, sourceProp, targetProp, getNonMissingTypeOfSymbol, reportErrors2, intersectionState, relation === comparableRelation);
|
|
@@ -65175,7 +65220,7 @@ function createTypeChecker(host) {
|
|
|
65175
65220
|
}
|
|
65176
65221
|
return result2;
|
|
65177
65222
|
}
|
|
65178
|
-
function signaturesRelatedTo(source2, target2, kind, reportErrors2) {
|
|
65223
|
+
function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
|
|
65179
65224
|
var _a3, _b;
|
|
65180
65225
|
if (relation === identityRelation) {
|
|
65181
65226
|
return signaturesIdenticalTo(source2, target2, kind);
|
|
@@ -65212,6 +65257,7 @@ function createTypeChecker(host) {
|
|
|
65212
65257
|
/*erase*/
|
|
65213
65258
|
true,
|
|
65214
65259
|
reportErrors2,
|
|
65260
|
+
intersectionState,
|
|
65215
65261
|
incompatibleReporter(sourceSignatures[i], targetSignatures[i])
|
|
65216
65262
|
);
|
|
65217
65263
|
if (!related) {
|
|
@@ -65223,7 +65269,7 @@ function createTypeChecker(host) {
|
|
|
65223
65269
|
const eraseGenerics = relation === comparableRelation || !!compilerOptions.noStrictGenericChecks;
|
|
65224
65270
|
const sourceSignature = first(sourceSignatures);
|
|
65225
65271
|
const targetSignature = first(targetSignatures);
|
|
65226
|
-
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, incompatibleReporter(sourceSignature, targetSignature));
|
|
65272
|
+
result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature));
|
|
65227
65273
|
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 */)) {
|
|
65228
65274
|
const constructSignatureToString = (signature) => signatureToString(
|
|
65229
65275
|
signature,
|
|
@@ -65248,6 +65294,7 @@ function createTypeChecker(host) {
|
|
|
65248
65294
|
/*erase*/
|
|
65249
65295
|
true,
|
|
65250
65296
|
shouldElaborateErrors,
|
|
65297
|
+
intersectionState,
|
|
65251
65298
|
incompatibleReporter(s, t)
|
|
65252
65299
|
);
|
|
65253
65300
|
if (related) {
|
|
@@ -65300,7 +65347,7 @@ function createTypeChecker(host) {
|
|
|
65300
65347
|
}
|
|
65301
65348
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
65302
65349
|
}
|
|
65303
|
-
function signatureRelatedTo(source2, target2, erase, reportErrors2, incompatibleReporter) {
|
|
65350
|
+
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
65304
65351
|
return compareSignaturesRelated(
|
|
65305
65352
|
erase ? getErasedSignature(source2) : source2,
|
|
65306
65353
|
erase ? getErasedSignature(target2) : target2,
|
|
@@ -65308,9 +65355,20 @@ function createTypeChecker(host) {
|
|
|
65308
65355
|
reportErrors2,
|
|
65309
65356
|
reportError,
|
|
65310
65357
|
incompatibleReporter,
|
|
65311
|
-
|
|
65358
|
+
isRelatedToWorker2,
|
|
65312
65359
|
reportUnreliableMapper
|
|
65313
65360
|
);
|
|
65361
|
+
function isRelatedToWorker2(source3, target3, reportErrors3) {
|
|
65362
|
+
return isRelatedTo(
|
|
65363
|
+
source3,
|
|
65364
|
+
target3,
|
|
65365
|
+
3 /* Both */,
|
|
65366
|
+
reportErrors3,
|
|
65367
|
+
/*headMessage*/
|
|
65368
|
+
void 0,
|
|
65369
|
+
intersectionState
|
|
65370
|
+
);
|
|
65371
|
+
}
|
|
65314
65372
|
}
|
|
65315
65373
|
function signaturesIdenticalTo(source2, target2, kind) {
|
|
65316
65374
|
const sourceSignatures = getSignaturesOfType(source2, kind);
|
|
@@ -65369,7 +65427,7 @@ function createTypeChecker(host) {
|
|
|
65369
65427
|
}
|
|
65370
65428
|
for (const info of getIndexInfosOfType(source2)) {
|
|
65371
65429
|
if (isApplicableIndexType(info.keyType, keyType)) {
|
|
65372
|
-
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2);
|
|
65430
|
+
const related = indexInfoRelatedTo(info, targetInfo, reportErrors2, intersectionState);
|
|
65373
65431
|
if (!related) {
|
|
65374
65432
|
return 0 /* False */;
|
|
65375
65433
|
}
|
|
@@ -65378,8 +65436,16 @@ function createTypeChecker(host) {
|
|
|
65378
65436
|
}
|
|
65379
65437
|
return result2;
|
|
65380
65438
|
}
|
|
65381
|
-
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2) {
|
|
65382
|
-
const related = isRelatedTo(
|
|
65439
|
+
function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState) {
|
|
65440
|
+
const related = isRelatedTo(
|
|
65441
|
+
sourceInfo.type,
|
|
65442
|
+
targetInfo.type,
|
|
65443
|
+
3 /* Both */,
|
|
65444
|
+
reportErrors2,
|
|
65445
|
+
/*headMessage*/
|
|
65446
|
+
void 0,
|
|
65447
|
+
intersectionState
|
|
65448
|
+
);
|
|
65383
65449
|
if (!related && reportErrors2) {
|
|
65384
65450
|
if (sourceInfo.keyType === targetInfo.keyType) {
|
|
65385
65451
|
reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
|
|
@@ -65408,7 +65474,7 @@ function createTypeChecker(host) {
|
|
|
65408
65474
|
function typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
|
|
65409
65475
|
const sourceInfo = getApplicableIndexInfo(source2, targetInfo.keyType);
|
|
65410
65476
|
if (sourceInfo) {
|
|
65411
|
-
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2);
|
|
65477
|
+
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
65412
65478
|
}
|
|
65413
65479
|
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
65414
65480
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
@@ -65699,12 +65765,15 @@ function createTypeChecker(host) {
|
|
|
65699
65765
|
}
|
|
65700
65766
|
function isDeeplyNestedType(type, stack, depth, maxDepth = 3) {
|
|
65701
65767
|
if (depth >= maxDepth) {
|
|
65768
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
65769
|
+
return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth));
|
|
65770
|
+
}
|
|
65702
65771
|
const identity2 = getRecursionIdentity(type);
|
|
65703
65772
|
let count = 0;
|
|
65704
65773
|
let lastTypeId = 0;
|
|
65705
65774
|
for (let i = 0; i < depth; i++) {
|
|
65706
65775
|
const t = stack[i];
|
|
65707
|
-
if (getRecursionIdentity(t) === identity2) {
|
|
65776
|
+
if (t.flags & 2097152 /* Intersection */ ? some(t.types, (u) => getRecursionIdentity(u) === identity2) : getRecursionIdentity(t) === identity2) {
|
|
65708
65777
|
if (t.id >= lastTypeId) {
|
|
65709
65778
|
count++;
|
|
65710
65779
|
if (count >= maxDepth) {
|
|
@@ -68072,7 +68141,7 @@ function createTypeChecker(host) {
|
|
|
68072
68141
|
}
|
|
68073
68142
|
return getUnionTypeFromSortedList(
|
|
68074
68143
|
filtered,
|
|
68075
|
-
type.objectFlags,
|
|
68144
|
+
type.objectFlags & (32768 /* PrimitiveUnion */ | 16777216 /* ContainsIntersections */),
|
|
68076
68145
|
/*aliasSymbol*/
|
|
68077
68146
|
void 0,
|
|
68078
68147
|
/*aliasTypeArguments*/
|
|
@@ -68579,7 +68648,7 @@ function createTypeChecker(host) {
|
|
|
68579
68648
|
}
|
|
68580
68649
|
return declaredType;
|
|
68581
68650
|
}
|
|
68582
|
-
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ &&
|
|
68651
|
+
if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
|
|
68583
68652
|
return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
|
|
68584
68653
|
}
|
|
68585
68654
|
return void 0;
|
|
@@ -74723,7 +74792,7 @@ function createTypeChecker(host) {
|
|
|
74723
74792
|
}
|
|
74724
74793
|
}
|
|
74725
74794
|
function checkCallExpression(node, checkMode) {
|
|
74726
|
-
var _a2;
|
|
74795
|
+
var _a2, _b, _c;
|
|
74727
74796
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
74728
74797
|
const signature = getResolvedSignature(
|
|
74729
74798
|
node,
|
|
@@ -74740,7 +74809,7 @@ function createTypeChecker(host) {
|
|
|
74740
74809
|
}
|
|
74741
74810
|
if (node.kind === 211 /* NewExpression */) {
|
|
74742
74811
|
const declaration = signature.declaration;
|
|
74743
|
-
if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) {
|
|
74812
|
+
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)) {
|
|
74744
74813
|
if (noImplicitAny) {
|
|
74745
74814
|
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
|
74746
74815
|
}
|
|
@@ -74768,7 +74837,7 @@ function createTypeChecker(host) {
|
|
|
74768
74837
|
/*allowDeclaration*/
|
|
74769
74838
|
false
|
|
74770
74839
|
);
|
|
74771
|
-
if ((
|
|
74840
|
+
if ((_c = jsSymbol == null ? void 0 : jsSymbol.exports) == null ? void 0 : _c.size) {
|
|
74772
74841
|
const jsAssignmentType = createAnonymousType(jsSymbol, jsSymbol.exports, emptyArray, emptyArray, emptyArray);
|
|
74773
74842
|
jsAssignmentType.objectFlags |= 4096 /* JSLiteral */;
|
|
74774
74843
|
return getIntersectionType([returnType, jsAssignmentType]);
|
|
@@ -77695,7 +77764,7 @@ function createTypeChecker(host) {
|
|
|
77695
77764
|
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression));
|
|
77696
77765
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
77697
77766
|
return getTypeFromTypeNode(expr.type);
|
|
77698
|
-
} else if (node
|
|
77767
|
+
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
77699
77768
|
return checkExpression(node);
|
|
77700
77769
|
}
|
|
77701
77770
|
return void 0;
|
|
@@ -108720,7 +108789,7 @@ function transformDeclarations(context) {
|
|
|
108720
108789
|
if (elem.kind === 229 /* OmittedExpression */) {
|
|
108721
108790
|
return elem;
|
|
108722
108791
|
}
|
|
108723
|
-
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced) {
|
|
108792
|
+
if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) {
|
|
108724
108793
|
return factory2.updateBindingElement(
|
|
108725
108794
|
elem,
|
|
108726
108795
|
elem.dotDotDotToken,
|
|
@@ -151081,7 +151150,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
151081
151150
|
}
|
|
151082
151151
|
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
|
|
151083
151152
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
151084
|
-
const quotedModuleSpecifier = quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
151153
|
+
const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier));
|
|
151085
151154
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
151086
151155
|
const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
151087
151156
|
const importKind = ts_codefix_exports.getImportKind(
|
|
@@ -153651,12 +153720,12 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, comp
|
|
|
153651
153720
|
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
153652
153721
|
const scriptPath = sourceFile.path;
|
|
153653
153722
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
153654
|
-
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, preferences, mode);
|
|
153723
|
+
const extensionOptions = getExtensionOptions(compilerOptions, ReferenceKind.ModuleSpecifier, sourceFile, typeChecker, preferences, mode);
|
|
153655
153724
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
|
|
153656
153725
|
}
|
|
153657
|
-
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, preferences, resolutionMode) {
|
|
153726
|
+
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
153658
153727
|
return {
|
|
153659
|
-
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)),
|
|
153728
|
+
extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker)),
|
|
153660
153729
|
referenceKind,
|
|
153661
153730
|
importingSourceFile,
|
|
153662
153731
|
endingPreference: preferences == null ? void 0 : preferences.importModuleSpecifierEnding,
|
|
@@ -153686,8 +153755,17 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
153686
153755
|
).values());
|
|
153687
153756
|
}
|
|
153688
153757
|
}
|
|
153689
|
-
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
153690
|
-
const
|
|
153758
|
+
function getSupportedExtensionsForModuleResolution(compilerOptions, typeChecker) {
|
|
153759
|
+
const ambientModulesExtensions = !typeChecker ? [] : mapDefined(
|
|
153760
|
+
typeChecker.getAmbientModules(),
|
|
153761
|
+
(module2) => {
|
|
153762
|
+
const name = module2.name.slice(1, -1);
|
|
153763
|
+
if (!name.startsWith("*.") || name.includes("/"))
|
|
153764
|
+
return;
|
|
153765
|
+
return name.slice(1);
|
|
153766
|
+
}
|
|
153767
|
+
);
|
|
153768
|
+
const extensions = [...getSupportedExtensions(compilerOptions), ambientModulesExtensions];
|
|
153691
153769
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
153692
153770
|
return moduleResolutionUsesNodeModules(moduleResolution) ? getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) : extensions;
|
|
153693
153771
|
}
|
|
@@ -160874,6 +160952,7 @@ function convertToBlock(body) {
|
|
|
160874
160952
|
if (isExpression(body)) {
|
|
160875
160953
|
const returnStatement = factory.createReturnStatement(body);
|
|
160876
160954
|
const file = body.getSourceFile();
|
|
160955
|
+
setTextRange(returnStatement, body);
|
|
160877
160956
|
suppressLeadingAndTrailingTrivia(returnStatement);
|
|
160878
160957
|
copyTrailingAsLeadingComments(
|
|
160879
160958
|
body,
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -6310,6 +6310,7 @@ declare namespace ts {
|
|
|
6310
6310
|
}
|
|
6311
6311
|
interface TypeChecker {
|
|
6312
6312
|
getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type;
|
|
6313
|
+
getTypeOfSymbol(symbol: Symbol): Type;
|
|
6313
6314
|
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
|
6314
6315
|
getPropertiesOfType(type: Type): Symbol[];
|
|
6315
6316
|
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
|
|
@@ -6400,6 +6401,21 @@ declare namespace ts {
|
|
|
6400
6401
|
getApparentType(type: Type): Type;
|
|
6401
6402
|
getBaseConstraintOfType(type: Type): Type | undefined;
|
|
6402
6403
|
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
|
6404
|
+
/**
|
|
6405
|
+
* True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
|
|
6406
|
+
* This function will _not_ return true if passed a type which
|
|
6407
|
+
* extends `Array` (for example, the TypeScript AST's `NodeArray` type).
|
|
6408
|
+
*/
|
|
6409
|
+
isArrayType(type: Type): boolean;
|
|
6410
|
+
/**
|
|
6411
|
+
* True if this type is a tuple type. This function will _not_ return true if
|
|
6412
|
+
* passed a type which extends from a tuple.
|
|
6413
|
+
*/
|
|
6414
|
+
isTupleType(type: Type): boolean;
|
|
6415
|
+
/**
|
|
6416
|
+
* True if this type is assignable to `ReadonlyArray<any>`.
|
|
6417
|
+
*/
|
|
6418
|
+
isArrayLikeType(type: Type): boolean;
|
|
6403
6419
|
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
|
6404
6420
|
/**
|
|
6405
6421
|
* Depending on the operation performed, it may be appropriate to throw away the checker
|