typescript 5.0.0-dev.20221207 → 5.0.0-dev.20221209
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.es2021.intl.d.ts +15 -0
- package/lib/tsc.js +42 -50
- package/lib/tsserver.js +63 -56
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +63 -56
- package/lib/typescript.d.ts +2 -1
- package/lib/typescript.js +50 -52
- package/lib/typingsInstaller.js +4 -6
- package/package.json +3 -2
package/lib/tsserver.js
CHANGED
|
@@ -2645,7 +2645,7 @@ __export(ts_server_exports3, {
|
|
|
2645
2645
|
|
|
2646
2646
|
// src/compiler/corePublic.ts
|
|
2647
2647
|
var versionMajorMinor = "5.0";
|
|
2648
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2648
|
+
var version = `${versionMajorMinor}.0-dev.20221209`;
|
|
2649
2649
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2650
2650
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2651
2651
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19103,7 +19103,7 @@ function getSetExternalModuleIndicator(options) {
|
|
|
19103
19103
|
}
|
|
19104
19104
|
}
|
|
19105
19105
|
function getEmitScriptTarget(compilerOptions) {
|
|
19106
|
-
return compilerOptions.target || compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ ||
|
|
19106
|
+
return compilerOptions.target || compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */;
|
|
19107
19107
|
}
|
|
19108
19108
|
function getEmitModuleKind(compilerOptions) {
|
|
19109
19109
|
return typeof compilerOptions.module === "number" ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
|
|
@@ -43504,8 +43504,9 @@ function createTypeChecker(host) {
|
|
|
43504
43504
|
const nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
43505
43505
|
const undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
43506
43506
|
const undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */);
|
|
43507
|
+
const missingType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
43508
|
+
const undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType;
|
|
43507
43509
|
const optionalType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
43508
|
-
const missingType = exactOptionalPropertyTypes ? createIntrinsicType(32768 /* Undefined */, "undefined") : undefinedType;
|
|
43509
43510
|
const nullType = createIntrinsicType(65536 /* Null */, "null");
|
|
43510
43511
|
const nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */);
|
|
43511
43512
|
const stringType = createIntrinsicType(4 /* String */, "string");
|
|
@@ -53663,7 +53664,7 @@ function createTypeChecker(host) {
|
|
|
53663
53664
|
return links.resolvedJSDocType;
|
|
53664
53665
|
}
|
|
53665
53666
|
function getSubstitutionType(baseType, constraint) {
|
|
53666
|
-
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType
|
|
53667
|
+
if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType) {
|
|
53667
53668
|
return baseType;
|
|
53668
53669
|
}
|
|
53669
53670
|
const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
|
|
@@ -54403,10 +54404,9 @@ function createTypeChecker(host) {
|
|
|
54403
54404
|
if (includes & 3 /* AnyOrUnknown */) {
|
|
54404
54405
|
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType : includes & 65536 /* Null */ || containsType(typeSet, unknownType) ? unknownType : nonNullUnknownType;
|
|
54405
54406
|
}
|
|
54406
|
-
if (
|
|
54407
|
-
|
|
54408
|
-
|
|
54409
|
-
orderedRemoveItemAt(typeSet, missingIndex);
|
|
54407
|
+
if (includes & 32768 /* Undefined */) {
|
|
54408
|
+
if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
|
|
54409
|
+
orderedRemoveItemAt(typeSet, 1);
|
|
54410
54410
|
}
|
|
54411
54411
|
}
|
|
54412
54412
|
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
@@ -54531,7 +54531,7 @@ function createTypeChecker(host) {
|
|
|
54531
54531
|
if (type === wildcardType)
|
|
54532
54532
|
includes |= 8388608 /* IncludesWildcard */;
|
|
54533
54533
|
} else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
|
|
54534
|
-
if (
|
|
54534
|
+
if (type === missingType) {
|
|
54535
54535
|
includes |= 262144 /* IncludesMissingType */;
|
|
54536
54536
|
type = undefinedType;
|
|
54537
54537
|
}
|
|
@@ -54681,9 +54681,9 @@ function createTypeChecker(host) {
|
|
|
54681
54681
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
54682
54682
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
54683
54683
|
} else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
54684
|
-
const
|
|
54684
|
+
const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
|
|
54685
54685
|
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
54686
|
-
result = getUnionType([getIntersectionType(typeSet),
|
|
54686
|
+
result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
54687
54687
|
} else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
54688
54688
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
54689
54689
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
@@ -55102,7 +55102,7 @@ function createTypeChecker(host) {
|
|
|
55102
55102
|
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
55103
55103
|
return mapType(objectType, (t) => {
|
|
55104
55104
|
const restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
55105
|
-
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType,
|
|
55105
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([restType, missingType]) : restType;
|
|
55106
55106
|
});
|
|
55107
55107
|
}
|
|
55108
55108
|
}
|
|
@@ -55122,11 +55122,11 @@ function createTypeChecker(host) {
|
|
|
55122
55122
|
if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
55123
55123
|
const indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
55124
55124
|
error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
|
|
55125
|
-
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type,
|
|
55125
|
+
return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
55126
55126
|
}
|
|
55127
55127
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
55128
55128
|
if (accessFlags & 1 /* IncludeUndefined */ && !(objectType.symbol && objectType.symbol.flags & (256 /* RegularEnum */ | 128 /* ConstEnum */) && (indexType.symbol && indexType.flags & 1024 /* EnumLiteral */ && getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
|
|
55129
|
-
return getUnionType([indexInfo.type,
|
|
55129
|
+
return getUnionType([indexInfo.type, missingType]);
|
|
55130
55130
|
}
|
|
55131
55131
|
return indexInfo.type;
|
|
55132
55132
|
}
|
|
@@ -59587,8 +59587,8 @@ function createTypeChecker(host) {
|
|
|
59587
59587
|
}
|
|
59588
59588
|
function getOptionalType(type, isProperty = false) {
|
|
59589
59589
|
Debug.assert(strictNullChecks);
|
|
59590
|
-
const missingOrUndefined = isProperty ?
|
|
59591
|
-
return type
|
|
59590
|
+
const missingOrUndefined = isProperty ? undefinedOrMissingType : undefinedType;
|
|
59591
|
+
return type === missingOrUndefined || type.flags & 1048576 /* Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
|
|
59592
59592
|
}
|
|
59593
59593
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
59594
59594
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
@@ -59615,7 +59615,7 @@ function createTypeChecker(host) {
|
|
|
59615
59615
|
return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type;
|
|
59616
59616
|
}
|
|
59617
59617
|
function containsMissingType(type) {
|
|
59618
|
-
return
|
|
59618
|
+
return type === missingType || !!(type.flags & 1048576 /* Union */) && type.types[0] === missingType;
|
|
59619
59619
|
}
|
|
59620
59620
|
function removeMissingOrUndefinedType(type) {
|
|
59621
59621
|
return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, 524288 /* NEUndefined */);
|
|
@@ -59715,7 +59715,7 @@ function createTypeChecker(host) {
|
|
|
59715
59715
|
if (cached) {
|
|
59716
59716
|
return cached;
|
|
59717
59717
|
}
|
|
59718
|
-
const result = createSymbolWithType(prop,
|
|
59718
|
+
const result = createSymbolWithType(prop, undefinedOrMissingType);
|
|
59719
59719
|
result.flags |= 16777216 /* Optional */;
|
|
59720
59720
|
undefinedProperties.set(prop.escapedName, result);
|
|
59721
59721
|
return result;
|
|
@@ -60765,7 +60765,7 @@ function createTypeChecker(host) {
|
|
|
60765
60765
|
}
|
|
60766
60766
|
}
|
|
60767
60767
|
function isTypeOrBaseIdenticalTo(s, t) {
|
|
60768
|
-
return
|
|
60768
|
+
return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 4 /* String */ && s.flags & 128 /* StringLiteral */ || t.flags & 8 /* Number */ && s.flags & 256 /* NumberLiteral */);
|
|
60769
60769
|
}
|
|
60770
60770
|
function isTypeCloselyMatchedBy(s, t) {
|
|
60771
60771
|
return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol);
|
|
@@ -61294,7 +61294,7 @@ function createTypeChecker(host) {
|
|
|
61294
61294
|
function includeUndefinedInIndexSignature(type) {
|
|
61295
61295
|
if (!type)
|
|
61296
61296
|
return type;
|
|
61297
|
-
return compilerOptions.noUncheckedIndexedAccess ? getUnionType([type,
|
|
61297
|
+
return compilerOptions.noUncheckedIndexedAccess ? getUnionType([type, missingType]) : type;
|
|
61298
61298
|
}
|
|
61299
61299
|
function getTypeOfDestructuredSpreadExpression(type) {
|
|
61300
61300
|
return createArrayType(checkIteratedTypeOrElementType(65 /* Destructuring */, type, undefinedType, void 0) || errorType);
|
|
@@ -62059,7 +62059,7 @@ function createTypeChecker(host) {
|
|
|
62059
62059
|
if (bypassFlow) {
|
|
62060
62060
|
const flowType = getTypeAtFlowNode(bypassFlow);
|
|
62061
62061
|
const type = getTypeFromFlowType(flowType);
|
|
62062
|
-
if (!contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) {
|
|
62062
|
+
if (!(type.flags & 131072 /* Never */) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.switchStatement)) {
|
|
62063
62063
|
if (type === declaredType && declaredType === initialType) {
|
|
62064
62064
|
return type;
|
|
62065
62065
|
}
|
|
@@ -64198,7 +64198,7 @@ function createTypeChecker(host) {
|
|
|
64198
64198
|
}
|
|
64199
64199
|
} else if (exactOptionalPropertyTypes && e.kind === 229 /* OmittedExpression */) {
|
|
64200
64200
|
hasOmittedExpression = true;
|
|
64201
|
-
elementTypes.push(
|
|
64201
|
+
elementTypes.push(undefinedOrMissingType);
|
|
64202
64202
|
elementFlags.push(2 /* Optional */);
|
|
64203
64203
|
} else {
|
|
64204
64204
|
const elementContextualType = getContextualTypeForElementExpression(contextualType, elementTypes.length);
|
|
@@ -65345,7 +65345,7 @@ function createTypeChecker(host) {
|
|
|
65345
65345
|
if (indexInfo.isReadonly && (isAssignmentTarget(node) || isDeleteTarget(node))) {
|
|
65346
65346
|
error(node, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(apparentType));
|
|
65347
65347
|
}
|
|
65348
|
-
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type,
|
|
65348
|
+
propType = compilerOptions.noUncheckedIndexedAccess && !isAssignmentTarget(node) ? getUnionType([indexInfo.type, missingType]) : indexInfo.type;
|
|
65349
65349
|
if (compilerOptions.noPropertyAccessFromIndexSignature && isPropertyAccessExpression(node)) {
|
|
65350
65350
|
error(right, Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0, unescapeLeadingUnderscores(right.escapedText));
|
|
65351
65351
|
}
|
|
@@ -67547,6 +67547,7 @@ function createTypeChecker(host) {
|
|
|
67547
67547
|
}
|
|
67548
67548
|
function checkExpressionWithTypeArguments(node) {
|
|
67549
67549
|
checkGrammarExpressionWithTypeArguments(node);
|
|
67550
|
+
forEach(node.typeArguments, checkSourceElement);
|
|
67550
67551
|
const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName);
|
|
67551
67552
|
const typeArguments = node.typeArguments;
|
|
67552
67553
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
@@ -103129,6 +103130,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
103129
103130
|
getSymlinkCache,
|
|
103130
103131
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
103131
103132
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
103133
|
+
getCanonicalFileName,
|
|
103132
103134
|
getFileIncludeReasons: () => fileReasons,
|
|
103133
103135
|
structureIsReused,
|
|
103134
103136
|
writeFile: writeFile2
|
|
@@ -103753,7 +103755,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
103753
103755
|
}
|
|
103754
103756
|
function getDiagnosticsHelper(sourceFile, getDiagnostics2, cancellationToken) {
|
|
103755
103757
|
if (sourceFile) {
|
|
103756
|
-
return getDiagnostics2(sourceFile, cancellationToken);
|
|
103758
|
+
return sortAndDeduplicateDiagnostics(getDiagnostics2(sourceFile, cancellationToken));
|
|
103757
103759
|
}
|
|
103758
103760
|
return sortAndDeduplicateDiagnostics(flatMap(program.getSourceFiles(), (sourceFile2) => {
|
|
103759
103761
|
if (cancellationToken) {
|
|
@@ -105705,14 +105707,13 @@ var BuilderState;
|
|
|
105705
105707
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
105706
105708
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
105707
105709
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
105708
|
-
const getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
105709
105710
|
newProgram.getTypeChecker();
|
|
105710
105711
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
105711
105712
|
const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
|
|
105712
105713
|
const oldUncommittedSignature = useOldState ? (_a2 = oldState.oldSignatures) == null ? void 0 : _a2.get(sourceFile.resolvedPath) : void 0;
|
|
105713
105714
|
const signature = oldUncommittedSignature === void 0 ? useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) == null ? void 0 : _b.signature : void 0 : oldUncommittedSignature || void 0;
|
|
105714
105715
|
if (referencedMap) {
|
|
105715
|
-
const newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
|
|
105716
|
+
const newReferences = getReferencedFiles(newProgram, sourceFile, newProgram.getCanonicalFileName);
|
|
105716
105717
|
if (newReferences) {
|
|
105717
105718
|
referencedMap.set(sourceFile.resolvedPath, newReferences);
|
|
105718
105719
|
}
|
|
@@ -106112,7 +106113,6 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
106112
106113
|
if (!diagnostics.length)
|
|
106113
106114
|
return emptyArray;
|
|
106114
106115
|
let buildInfoDirectory;
|
|
106115
|
-
let getCanonicalFileName;
|
|
106116
106116
|
return diagnostics.map((diagnostic) => {
|
|
106117
106117
|
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3);
|
|
106118
106118
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -106125,7 +106125,7 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
106125
106125
|
});
|
|
106126
106126
|
function toPath3(path) {
|
|
106127
106127
|
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
106128
|
-
return toPath(path, buildInfoDirectory,
|
|
106128
|
+
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
106129
106129
|
}
|
|
106130
106130
|
}
|
|
106131
106131
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
|
|
@@ -106423,7 +106423,6 @@ function isProgramBundleEmitBuildInfo(info) {
|
|
|
106423
106423
|
function getBuildInfo2(state, bundle) {
|
|
106424
106424
|
var _a2, _b, _c;
|
|
106425
106425
|
const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
|
|
106426
|
-
const getCanonicalFileName = createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
106427
106426
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
106428
106427
|
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
|
|
106429
106428
|
const fileNames = [];
|
|
@@ -106541,7 +106540,7 @@ function getBuildInfo2(state, bundle) {
|
|
|
106541
106540
|
return relativeToBuildInfo(getNormalizedAbsolutePath(path, currentDirectory));
|
|
106542
106541
|
}
|
|
106543
106542
|
function relativeToBuildInfo(path) {
|
|
106544
|
-
return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
106543
|
+
return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, state.program.getCanonicalFileName));
|
|
106545
106544
|
}
|
|
106546
106545
|
function toFileId(path) {
|
|
106547
106546
|
let fileId = fileNameToFileId.get(path);
|
|
@@ -106649,7 +106648,6 @@ function getTextHandlingSourceMapForSignature(text, data) {
|
|
|
106649
106648
|
}
|
|
106650
106649
|
function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) {
|
|
106651
106650
|
var _a2, _b;
|
|
106652
|
-
let getCanonicalFileName;
|
|
106653
106651
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
106654
106652
|
let sourceFileDirectory;
|
|
106655
106653
|
if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) {
|
|
@@ -106669,7 +106667,7 @@ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data)
|
|
|
106669
106667
|
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
106670
106668
|
sourceFileDirectory,
|
|
106671
106669
|
diagnostic.file.resolvedPath,
|
|
106672
|
-
|
|
106670
|
+
program.getCanonicalFileName
|
|
106673
106671
|
))}(${diagnostic.start},${diagnostic.length})`;
|
|
106674
106672
|
}
|
|
106675
106673
|
}
|
|
@@ -108074,8 +108072,7 @@ function listFiles(program, write) {
|
|
|
108074
108072
|
function explainFiles(program, write) {
|
|
108075
108073
|
var _a2, _b;
|
|
108076
108074
|
const reasons = program.getFileIncludeReasons();
|
|
108077
|
-
const
|
|
108078
|
-
const relativeFileName = (fileName) => convertToRelativePath(fileName, program.getCurrentDirectory(), getCanonicalFileName);
|
|
108075
|
+
const relativeFileName = (fileName) => convertToRelativePath(fileName, program.getCurrentDirectory(), program.getCanonicalFileName);
|
|
108079
108076
|
for (const file of program.getSourceFiles()) {
|
|
108080
108077
|
write(`${toFileName(file, relativeFileName)}`);
|
|
108081
108078
|
(_a2 = reasons.get(file.path)) == null ? void 0 : _a2.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
@@ -108133,10 +108130,9 @@ function getMatchedFileSpec(program, fileName) {
|
|
|
108133
108130
|
const configFile = program.getCompilerOptions().configFile;
|
|
108134
108131
|
if (!((_a2 = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _a2.validatedFilesSpec))
|
|
108135
108132
|
return void 0;
|
|
108136
|
-
const
|
|
108137
|
-
const filePath = getCanonicalFileName(fileName);
|
|
108133
|
+
const filePath = program.getCanonicalFileName(fileName);
|
|
108138
108134
|
const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
|
|
108139
|
-
return find(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
|
|
108135
|
+
return find(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath);
|
|
108140
108136
|
}
|
|
108141
108137
|
function getMatchedIncludeSpec(program, fileName) {
|
|
108142
108138
|
var _a2, _b;
|
|
@@ -109315,8 +109311,6 @@ function createSolutionBuilderWithWatch(host, rootNames, defaultOptions, baseWat
|
|
|
109315
109311
|
function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, options, baseWatchOptions) {
|
|
109316
109312
|
const host = hostOrHostWithWatch;
|
|
109317
109313
|
const hostWithWatch = hostOrHostWithWatch;
|
|
109318
|
-
const currentDirectory = host.getCurrentDirectory();
|
|
109319
|
-
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
109320
109314
|
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
|
109321
109315
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
109322
109316
|
setGetSourceFileAsHashVersioned(compilerHost);
|
|
@@ -109328,7 +109322,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
109328
109322
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
109329
109323
|
let moduleResolutionCache, typeReferenceDirectiveResolutionCache;
|
|
109330
109324
|
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
109331
|
-
moduleResolutionCache = createModuleResolutionCache(
|
|
109325
|
+
moduleResolutionCache = createModuleResolutionCache(compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName);
|
|
109332
109326
|
compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
109333
109327
|
moduleNames,
|
|
109334
109328
|
containingFile,
|
|
@@ -109342,7 +109336,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
109342
109336
|
compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
|
|
109343
109337
|
}
|
|
109344
109338
|
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
109345
|
-
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(
|
|
109339
|
+
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(compilerHost.getCurrentDirectory(), compilerHost.getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
109346
109340
|
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
109347
109341
|
typeDirectiveNames,
|
|
109348
109342
|
containingFile,
|
|
@@ -109359,8 +109353,6 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
109359
109353
|
const state = {
|
|
109360
109354
|
host,
|
|
109361
109355
|
hostWithWatch,
|
|
109362
|
-
currentDirectory,
|
|
109363
|
-
getCanonicalFileName,
|
|
109364
109356
|
parseConfigFileHost: parseConfigHostFromCompilerHostLike(host),
|
|
109365
109357
|
write: maybeBind(host, host.trace),
|
|
109366
109358
|
options,
|
|
@@ -109404,7 +109396,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
109404
109396
|
return state;
|
|
109405
109397
|
}
|
|
109406
109398
|
function toPath2(state, fileName) {
|
|
109407
|
-
return toPath(fileName, state.
|
|
109399
|
+
return toPath(fileName, state.compilerHost.getCurrentDirectory(), state.compilerHost.getCanonicalFileName);
|
|
109408
109400
|
}
|
|
109409
109401
|
function toResolvedConfigFilePath(state, fileName) {
|
|
109410
109402
|
const { resolvedConfigFilePaths } = state;
|
|
@@ -109447,7 +109439,7 @@ function parseConfigFile(state, configFileName, configFilePath) {
|
|
|
109447
109439
|
return parsed;
|
|
109448
109440
|
}
|
|
109449
109441
|
function resolveProjectName(state, name) {
|
|
109450
|
-
return resolveConfigFileProjectName(resolvePath(state.
|
|
109442
|
+
return resolveConfigFileProjectName(resolvePath(state.compilerHost.getCurrentDirectory(), name));
|
|
109451
109443
|
}
|
|
109452
109444
|
function createBuildOrder(state, roots) {
|
|
109453
109445
|
const temporaryMarks = /* @__PURE__ */ new Map();
|
|
@@ -109656,7 +109648,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
|
|
|
109656
109648
|
projectPath,
|
|
109657
109649
|
buildOrder,
|
|
109658
109650
|
getCompilerOptions: () => config.options,
|
|
109659
|
-
getCurrentDirectory: () => state.
|
|
109651
|
+
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
109660
109652
|
updateOutputFileStatmps: () => {
|
|
109661
109653
|
updateOutputTimestamps(state, config, projectPath);
|
|
109662
109654
|
updateOutputFileStampsPending = false;
|
|
@@ -109681,7 +109673,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
109681
109673
|
projectPath,
|
|
109682
109674
|
buildOrder,
|
|
109683
109675
|
getCompilerOptions: () => config.options,
|
|
109684
|
-
getCurrentDirectory: () => state.
|
|
109676
|
+
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
109685
109677
|
getBuilderProgram: () => withProgramOrUndefined(identity),
|
|
109686
109678
|
getProgram: () => withProgramOrUndefined(
|
|
109687
109679
|
(program2) => program2.getProgramOrUndefined()
|
|
@@ -109737,7 +109729,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
109737
109729
|
projectPath,
|
|
109738
109730
|
buildOrder,
|
|
109739
109731
|
getCompilerOptions: () => config.options,
|
|
109740
|
-
getCurrentDirectory: () => state.
|
|
109732
|
+
getCurrentDirectory: () => state.compilerHost.getCurrentDirectory(),
|
|
109741
109733
|
emit: (writeFile2, customTransformers) => {
|
|
109742
109734
|
if (step !== 4 /* EmitBundle */)
|
|
109743
109735
|
return invalidatedProjectOfBundle;
|
|
@@ -110844,7 +110836,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
|
|
|
110844
110836
|
fileOrDirectory,
|
|
110845
110837
|
fileOrDirectoryPath: toPath2(state, fileOrDirectory),
|
|
110846
110838
|
configFileName: resolved,
|
|
110847
|
-
currentDirectory: state.
|
|
110839
|
+
currentDirectory: state.compilerHost.getCurrentDirectory(),
|
|
110848
110840
|
options: parsed.options,
|
|
110849
110841
|
program: state.builderPrograms.get(resolvedPath) || ((_a2 = getCachedParsedConfigFile(state, resolvedPath)) == null ? void 0 : _a2.fileNames),
|
|
110850
110842
|
useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames,
|
|
@@ -110949,7 +110941,7 @@ function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, opti
|
|
|
110949
110941
|
};
|
|
110950
110942
|
}
|
|
110951
110943
|
function relName(state, path) {
|
|
110952
|
-
return convertToRelativePath(path, state.
|
|
110944
|
+
return convertToRelativePath(path, state.compilerHost.getCurrentDirectory(), state.compilerHost.getCanonicalFileName);
|
|
110953
110945
|
}
|
|
110954
110946
|
function reportStatus(state, message, ...args) {
|
|
110955
110947
|
state.host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args));
|
|
@@ -121617,7 +121609,8 @@ var invalidOperationsInPartialSemanticMode = [
|
|
|
121617
121609
|
"prepareCallHierarchy",
|
|
121618
121610
|
"provideCallHierarchyIncomingCalls",
|
|
121619
121611
|
"provideCallHierarchyOutgoingCalls",
|
|
121620
|
-
"provideInlayHints"
|
|
121612
|
+
"provideInlayHints",
|
|
121613
|
+
"getSupportedCodeFixes"
|
|
121621
121614
|
];
|
|
121622
121615
|
var invalidOperationsInSyntacticMode = [
|
|
121623
121616
|
...invalidOperationsInPartialSemanticMode,
|
|
@@ -122714,7 +122707,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
122714
122707
|
toggleMultilineComment,
|
|
122715
122708
|
commentSelection,
|
|
122716
122709
|
uncommentSelection,
|
|
122717
|
-
provideInlayHints: provideInlayHints2
|
|
122710
|
+
provideInlayHints: provideInlayHints2,
|
|
122711
|
+
getSupportedCodeFixes
|
|
122718
122712
|
};
|
|
122719
122713
|
switch (languageServiceMode) {
|
|
122720
122714
|
case 0 /* Semantic */:
|
|
@@ -135041,6 +135035,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
135041
135035
|
const typeExpression = isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression;
|
|
135042
135036
|
return typeExpression && typeExpression.kind === 312 /* JSDocTypeExpression */ ? typeExpression : void 0;
|
|
135043
135037
|
}
|
|
135038
|
+
if (isJSDocAugmentsTag(tag) || isJSDocImplementsTag(tag)) {
|
|
135039
|
+
return tag.class;
|
|
135040
|
+
}
|
|
135044
135041
|
return void 0;
|
|
135045
135042
|
}
|
|
135046
135043
|
function getTypeScriptMemberSymbols() {
|
|
@@ -140566,6 +140563,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
140566
140563
|
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
140567
140564
|
if (newImportDecls.length === 0) {
|
|
140568
140565
|
changeTracker.deleteNodes(sourceFile, oldImportDecls, {
|
|
140566
|
+
leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude,
|
|
140569
140567
|
trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include
|
|
140570
140568
|
}, true);
|
|
140571
140569
|
} else {
|
|
@@ -158715,8 +158713,8 @@ var Session3 = class {
|
|
|
158715
158713
|
[CommandNames.ApplyCodeActionCommand]: (request) => {
|
|
158716
158714
|
return this.requiredResponse(this.applyCodeActionCommand(request.arguments));
|
|
158717
158715
|
},
|
|
158718
|
-
[CommandNames.GetSupportedCodeFixes]: () => {
|
|
158719
|
-
return this.requiredResponse(this.getSupportedCodeFixes());
|
|
158716
|
+
[CommandNames.GetSupportedCodeFixes]: (request) => {
|
|
158717
|
+
return this.requiredResponse(this.getSupportedCodeFixes(request.arguments));
|
|
158720
158718
|
},
|
|
158721
158719
|
[CommandNames.GetApplicableRefactors]: (request) => {
|
|
158722
158720
|
return this.requiredResponse(this.getApplicableRefactors(request.arguments));
|
|
@@ -160202,8 +160200,17 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
160202
160200
|
return a.containerKind === b.containerKind && a.containerName === b.containerName && a.fileName === b.fileName && a.isCaseSensitive === b.isCaseSensitive && a.kind === b.kind && a.kindModifiers === b.kindModifiers && a.matchKind === b.matchKind && a.name === b.name && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length;
|
|
160203
160201
|
}
|
|
160204
160202
|
}
|
|
160205
|
-
getSupportedCodeFixes() {
|
|
160206
|
-
|
|
160203
|
+
getSupportedCodeFixes(args) {
|
|
160204
|
+
if (!args)
|
|
160205
|
+
return getSupportedCodeFixes();
|
|
160206
|
+
if (args.file) {
|
|
160207
|
+
const { file, project: project2 } = this.getFileAndProject(args);
|
|
160208
|
+
return project2.getLanguageService().getSupportedCodeFixes(file);
|
|
160209
|
+
}
|
|
160210
|
+
const project = this.getProject(args.projectFileName);
|
|
160211
|
+
if (!project)
|
|
160212
|
+
Errors.ThrowNoProject();
|
|
160213
|
+
return project.getLanguageService().getSupportedCodeFixes();
|
|
160207
160214
|
}
|
|
160208
160215
|
isLocation(locationOrSpan) {
|
|
160209
160216
|
return locationOrSpan.line !== void 0;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -691,6 +691,7 @@ declare namespace ts {
|
|
|
691
691
|
*/
|
|
692
692
|
interface GetSupportedCodeFixesRequest extends Request {
|
|
693
693
|
command: CommandTypes.GetSupportedCodeFixes;
|
|
694
|
+
arguments?: Partial<FileRequestArgs>;
|
|
694
695
|
}
|
|
695
696
|
/**
|
|
696
697
|
* A response for GetSupportedCodeFixesRequest request.
|
|
@@ -10051,6 +10052,7 @@ declare namespace ts {
|
|
|
10051
10052
|
toggleMultilineComment(fileName: string, textRange: TextRange): TextChange[];
|
|
10052
10053
|
commentSelection(fileName: string, textRange: TextRange): TextChange[];
|
|
10053
10054
|
uncommentSelection(fileName: string, textRange: TextRange): TextChange[];
|
|
10055
|
+
getSupportedCodeFixes(fileName?: string): readonly string[];
|
|
10054
10056
|
dispose(): void;
|
|
10055
10057
|
}
|
|
10056
10058
|
interface JsxClosingTagInfo {
|
|
@@ -11033,7 +11035,7 @@ declare namespace ts {
|
|
|
11033
11035
|
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
|
|
11034
11036
|
function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string;
|
|
11035
11037
|
function getDefaultCompilerOptions(): CompilerOptions;
|
|
11036
|
-
function getSupportedCodeFixes(): string[];
|
|
11038
|
+
function getSupportedCodeFixes(): readonly string[];
|
|
11037
11039
|
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTargetOrOptions: ScriptTarget | CreateSourceFileOptions, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
|
|
11038
11040
|
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile;
|
|
11039
11041
|
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnlyOrLanguageServiceMode?: boolean | LanguageServiceMode): LanguageService;
|