@typescript-deploys/pr-build 5.3.0-pr-55273-3 → 5.3.0-pr-55020-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 +131 -63
- package/lib/tsserver.js +158 -69
- package/lib/typescript.js +156 -69
- package/lib/typingsInstaller.js +20 -21
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -1416,6 +1416,7 @@ __export(server_exports, {
|
|
|
1416
1416
|
isImportTypeNode: () => isImportTypeNode,
|
|
1417
1417
|
isImportableFile: () => isImportableFile,
|
|
1418
1418
|
isInComment: () => isInComment,
|
|
1419
|
+
isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
|
|
1419
1420
|
isInExpressionContext: () => isInExpressionContext,
|
|
1420
1421
|
isInJSDoc: () => isInJSDoc,
|
|
1421
1422
|
isInJSFile: () => isInJSFile,
|
|
@@ -1709,6 +1710,7 @@ __export(server_exports, {
|
|
|
1709
1710
|
isSetAccessor: () => isSetAccessor,
|
|
1710
1711
|
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
|
|
1711
1712
|
isShebangTrivia: () => isShebangTrivia,
|
|
1713
|
+
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
|
|
1712
1714
|
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
|
|
1713
1715
|
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
|
|
1714
1716
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
@@ -2331,7 +2333,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2331
2333
|
|
|
2332
2334
|
// src/compiler/corePublic.ts
|
|
2333
2335
|
var versionMajorMinor = "5.3";
|
|
2334
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2336
|
+
var version = `${versionMajorMinor}.0-insiders.20230816`;
|
|
2335
2337
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2336
2338
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2337
2339
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -16244,16 +16246,14 @@ function createDiagnosticForNodeArrayFromMessageChain(sourceFile, nodes, message
|
|
|
16244
16246
|
const start2 = skipTrivia(sourceFile.text, nodes.pos);
|
|
16245
16247
|
return createFileDiagnosticFromMessageChain(sourceFile, start2, nodes.end - start2, messageChain, relatedInformation);
|
|
16246
16248
|
}
|
|
16247
|
-
function assertDiagnosticLocation(
|
|
16249
|
+
function assertDiagnosticLocation(sourceText, start2, length2) {
|
|
16248
16250
|
Debug.assertGreaterThanOrEqual(start2, 0);
|
|
16249
16251
|
Debug.assertGreaterThanOrEqual(length2, 0);
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
Debug.assertLessThanOrEqual(start2 + length2, file.text.length);
|
|
16253
|
-
}
|
|
16252
|
+
Debug.assertLessThanOrEqual(start2, sourceText.length);
|
|
16253
|
+
Debug.assertLessThanOrEqual(start2 + length2, sourceText.length);
|
|
16254
16254
|
}
|
|
16255
16255
|
function createFileDiagnosticFromMessageChain(file, start2, length2, messageChain, relatedInformation) {
|
|
16256
|
-
assertDiagnosticLocation(file, start2, length2);
|
|
16256
|
+
assertDiagnosticLocation(file.text, start2, length2);
|
|
16257
16257
|
return {
|
|
16258
16258
|
file,
|
|
16259
16259
|
start: start2,
|
|
@@ -17128,8 +17128,8 @@ function isInExpressionContext(node) {
|
|
|
17128
17128
|
return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
|
|
17129
17129
|
case 249 /* ForInStatement */:
|
|
17130
17130
|
case 250 /* ForOfStatement */:
|
|
17131
|
-
const
|
|
17132
|
-
return
|
|
17131
|
+
const forInOrOfStatement = parent2;
|
|
17132
|
+
return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
|
|
17133
17133
|
case 216 /* TypeAssertionExpression */:
|
|
17134
17134
|
case 234 /* AsExpression */:
|
|
17135
17135
|
return node === parent2.expression;
|
|
@@ -17825,20 +17825,23 @@ var AssignmentKind = /* @__PURE__ */ ((AssignmentKind2) => {
|
|
|
17825
17825
|
AssignmentKind2[AssignmentKind2["Compound"] = 2] = "Compound";
|
|
17826
17826
|
return AssignmentKind2;
|
|
17827
17827
|
})(AssignmentKind || {});
|
|
17828
|
-
function
|
|
17828
|
+
function getAssignmentTarget(node) {
|
|
17829
17829
|
let parent2 = node.parent;
|
|
17830
17830
|
while (true) {
|
|
17831
17831
|
switch (parent2.kind) {
|
|
17832
17832
|
case 226 /* BinaryExpression */:
|
|
17833
|
-
const
|
|
17834
|
-
|
|
17833
|
+
const binaryExpression = parent2;
|
|
17834
|
+
const binaryOperator = binaryExpression.operatorToken.kind;
|
|
17835
|
+
return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
|
|
17835
17836
|
case 224 /* PrefixUnaryExpression */:
|
|
17836
17837
|
case 225 /* PostfixUnaryExpression */:
|
|
17837
|
-
const
|
|
17838
|
-
|
|
17838
|
+
const unaryExpression = parent2;
|
|
17839
|
+
const unaryOperator = unaryExpression.operator;
|
|
17840
|
+
return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
|
|
17839
17841
|
case 249 /* ForInStatement */:
|
|
17840
17842
|
case 250 /* ForOfStatement */:
|
|
17841
|
-
|
|
17843
|
+
const forInOrOfStatement = parent2;
|
|
17844
|
+
return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
|
|
17842
17845
|
case 217 /* ParenthesizedExpression */:
|
|
17843
17846
|
case 209 /* ArrayLiteralExpression */:
|
|
17844
17847
|
case 230 /* SpreadElement */:
|
|
@@ -17850,24 +17853,53 @@ function getAssignmentTargetKind(node) {
|
|
|
17850
17853
|
break;
|
|
17851
17854
|
case 304 /* ShorthandPropertyAssignment */:
|
|
17852
17855
|
if (parent2.name !== node) {
|
|
17853
|
-
return 0
|
|
17856
|
+
return void 0;
|
|
17854
17857
|
}
|
|
17855
17858
|
node = parent2.parent;
|
|
17856
17859
|
break;
|
|
17857
17860
|
case 303 /* PropertyAssignment */:
|
|
17858
17861
|
if (parent2.name === node) {
|
|
17859
|
-
return 0
|
|
17862
|
+
return void 0;
|
|
17860
17863
|
}
|
|
17861
17864
|
node = parent2.parent;
|
|
17862
17865
|
break;
|
|
17863
17866
|
default:
|
|
17864
|
-
return 0
|
|
17867
|
+
return void 0;
|
|
17865
17868
|
}
|
|
17866
17869
|
parent2 = node.parent;
|
|
17867
17870
|
}
|
|
17868
17871
|
}
|
|
17872
|
+
function getAssignmentTargetKind(node) {
|
|
17873
|
+
const target = getAssignmentTarget(node);
|
|
17874
|
+
if (!target) {
|
|
17875
|
+
return 0 /* None */;
|
|
17876
|
+
}
|
|
17877
|
+
switch (target.kind) {
|
|
17878
|
+
case 226 /* BinaryExpression */:
|
|
17879
|
+
const binaryOperator = target.operatorToken.kind;
|
|
17880
|
+
return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
|
|
17881
|
+
case 224 /* PrefixUnaryExpression */:
|
|
17882
|
+
case 225 /* PostfixUnaryExpression */:
|
|
17883
|
+
return 2 /* Compound */;
|
|
17884
|
+
case 249 /* ForInStatement */:
|
|
17885
|
+
case 250 /* ForOfStatement */:
|
|
17886
|
+
return 1 /* Definite */;
|
|
17887
|
+
}
|
|
17888
|
+
}
|
|
17869
17889
|
function isAssignmentTarget(node) {
|
|
17870
|
-
return
|
|
17890
|
+
return !!getAssignmentTarget(node);
|
|
17891
|
+
}
|
|
17892
|
+
function isCompoundLikeAssignment(assignment) {
|
|
17893
|
+
const right = skipParentheses(assignment.right);
|
|
17894
|
+
return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
|
|
17895
|
+
}
|
|
17896
|
+
function isInCompoundLikeAssignment(node) {
|
|
17897
|
+
const target = getAssignmentTarget(node);
|
|
17898
|
+
return !!target && isAssignmentExpression(
|
|
17899
|
+
target,
|
|
17900
|
+
/*excludeCompoundAssignment*/
|
|
17901
|
+
true
|
|
17902
|
+
) && isCompoundLikeAssignment(target);
|
|
17871
17903
|
}
|
|
17872
17904
|
function isNodeWithPossibleHoistedDeclaration(node) {
|
|
17873
17905
|
switch (node.kind) {
|
|
@@ -18613,8 +18645,11 @@ var templateSubstitutionRegExp = /\$\{/g;
|
|
|
18613
18645
|
function escapeTemplateSubstitution(str) {
|
|
18614
18646
|
return str.replace(templateSubstitutionRegExp, "\\${");
|
|
18615
18647
|
}
|
|
18648
|
+
function containsInvalidEscapeFlag(node) {
|
|
18649
|
+
return !!((node.templateFlags || 0) & 2048 /* ContainsInvalidEscape */);
|
|
18650
|
+
}
|
|
18616
18651
|
function hasInvalidEscape(template) {
|
|
18617
|
-
return template && !!(isNoSubstitutionTemplateLiteral(template) ? template
|
|
18652
|
+
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
18618
18653
|
}
|
|
18619
18654
|
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
|
|
18620
18655
|
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g;
|
|
@@ -20180,13 +20215,11 @@ function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
|
20180
20215
|
function getLocaleSpecificMessage(message) {
|
|
20181
20216
|
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
20182
20217
|
}
|
|
20183
|
-
function createDetachedDiagnostic(fileName, start2, length2, message, ...args) {
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
|
|
20188
|
-
length2
|
|
20189
|
-
);
|
|
20218
|
+
function createDetachedDiagnostic(fileName, sourceText, start2, length2, message, ...args) {
|
|
20219
|
+
if (start2 + length2 > sourceText.length) {
|
|
20220
|
+
length2 = sourceText.length - start2;
|
|
20221
|
+
}
|
|
20222
|
+
assertDiagnosticLocation(sourceText, start2, length2);
|
|
20190
20223
|
let text = getLocaleSpecificMessage(message);
|
|
20191
20224
|
if (some(args)) {
|
|
20192
20225
|
text = formatStringFromArgs(text, args);
|
|
@@ -20242,7 +20275,7 @@ function attachFileToDiagnostics(diagnostics, file) {
|
|
|
20242
20275
|
return diagnosticsWithLocation;
|
|
20243
20276
|
}
|
|
20244
20277
|
function createFileDiagnostic(file, start2, length2, message, ...args) {
|
|
20245
|
-
assertDiagnosticLocation(file, start2, length2);
|
|
20278
|
+
assertDiagnosticLocation(file.text, start2, length2);
|
|
20246
20279
|
let text = getLocaleSpecificMessage(message);
|
|
20247
20280
|
if (some(args)) {
|
|
20248
20281
|
text = formatStringFromArgs(text, args);
|
|
@@ -31036,7 +31069,7 @@ var Parser;
|
|
|
31036
31069
|
}
|
|
31037
31070
|
return sourceFile;
|
|
31038
31071
|
function reportPragmaDiagnostic(pos, end, diagnostic) {
|
|
31039
|
-
parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
|
|
31072
|
+
parseDiagnostics.push(createDetachedDiagnostic(fileName, sourceText, pos, end, diagnostic));
|
|
31040
31073
|
}
|
|
31041
31074
|
}
|
|
31042
31075
|
let hasDeprecatedTag = false;
|
|
@@ -31276,7 +31309,7 @@ var Parser;
|
|
|
31276
31309
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
31277
31310
|
let result;
|
|
31278
31311
|
if (!lastError || start2 !== lastError.start) {
|
|
31279
|
-
result = createDetachedDiagnostic(fileName, start2, length2, message, ...args);
|
|
31312
|
+
result = createDetachedDiagnostic(fileName, sourceText, start2, length2, message, ...args);
|
|
31280
31313
|
parseDiagnostics.push(result);
|
|
31281
31314
|
}
|
|
31282
31315
|
parseErrorBeforeNextFinishedNode = true;
|
|
@@ -31504,7 +31537,7 @@ var Parser;
|
|
|
31504
31537
|
if (lastError) {
|
|
31505
31538
|
addRelatedInfo(
|
|
31506
31539
|
lastError,
|
|
31507
|
-
createDetachedDiagnostic(fileName, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
|
|
31540
|
+
createDetachedDiagnostic(fileName, sourceText, openPosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, tokenToString(openKind), tokenToString(closeKind))
|
|
31508
31541
|
);
|
|
31509
31542
|
}
|
|
31510
31543
|
}
|
|
@@ -33103,7 +33136,7 @@ var Parser;
|
|
|
33103
33136
|
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
33104
33137
|
addRelatedInfo(
|
|
33105
33138
|
lastError,
|
|
33106
|
-
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
33139
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
33107
33140
|
);
|
|
33108
33141
|
}
|
|
33109
33142
|
}
|
|
@@ -36220,7 +36253,7 @@ var Parser;
|
|
|
36220
36253
|
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
36221
36254
|
addRelatedInfo(
|
|
36222
36255
|
lastError,
|
|
36223
|
-
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
36256
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
36224
36257
|
);
|
|
36225
36258
|
}
|
|
36226
36259
|
}
|
|
@@ -37199,7 +37232,7 @@ var Parser;
|
|
|
37199
37232
|
if (childTypeTag) {
|
|
37200
37233
|
const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
37201
37234
|
if (lastError) {
|
|
37202
|
-
addRelatedInfo(lastError, createDetachedDiagnostic(fileName, 0, 0, Diagnostics.The_tag_was_first_specified_here));
|
|
37235
|
+
addRelatedInfo(lastError, createDetachedDiagnostic(fileName, sourceText, 0, 0, Diagnostics.The_tag_was_first_specified_here));
|
|
37203
37236
|
}
|
|
37204
37237
|
break;
|
|
37205
37238
|
} else {
|
|
@@ -41747,9 +41780,8 @@ function compilerOptionValueToString(value) {
|
|
|
41747
41780
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
41748
41781
|
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
41749
41782
|
}
|
|
41750
|
-
function createCacheWithRedirects(ownOptions) {
|
|
41783
|
+
function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
41751
41784
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
41752
|
-
const optionsToRedirectsKey = /* @__PURE__ */ new Map();
|
|
41753
41785
|
const redirectsKeyToMap = /* @__PURE__ */ new Map();
|
|
41754
41786
|
let ownMap = /* @__PURE__ */ new Map();
|
|
41755
41787
|
if (ownOptions)
|
|
@@ -41859,8 +41891,8 @@ function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create)
|
|
|
41859
41891
|
}
|
|
41860
41892
|
return result;
|
|
41861
41893
|
}
|
|
41862
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
41863
|
-
const directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
41894
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options, optionsToRedirectsKey) {
|
|
41895
|
+
const directoryToModuleNameMap = createCacheWithRedirects(options, optionsToRedirectsKey);
|
|
41864
41896
|
return {
|
|
41865
41897
|
getFromDirectoryCache,
|
|
41866
41898
|
getOrCreateCacheForDirectory,
|
|
@@ -41936,8 +41968,8 @@ function getOriginalOrResolvedModuleFileName(result) {
|
|
|
41936
41968
|
function getOriginalOrResolvedTypeReferenceFileName(result) {
|
|
41937
41969
|
return result.resolvedTypeReferenceDirective && (result.resolvedTypeReferenceDirective.originalPath || result.resolvedTypeReferenceDirective.resolvedFileName);
|
|
41938
41970
|
}
|
|
41939
|
-
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName) {
|
|
41940
|
-
const moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
41971
|
+
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName, optionsToRedirectsKey) {
|
|
41972
|
+
const moduleNameToDirectoryMap = createCacheWithRedirects(options, optionsToRedirectsKey);
|
|
41941
41973
|
return {
|
|
41942
41974
|
getFromNonRelativeNameCache,
|
|
41943
41975
|
getOrCreateCacheForNonRelativeName,
|
|
@@ -42005,13 +42037,20 @@ function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFile
|
|
|
42005
42037
|
}
|
|
42006
42038
|
}
|
|
42007
42039
|
}
|
|
42008
|
-
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName) {
|
|
42009
|
-
|
|
42040
|
+
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName, optionsToRedirectsKey) {
|
|
42041
|
+
optionsToRedirectsKey ?? (optionsToRedirectsKey = /* @__PURE__ */ new Map());
|
|
42042
|
+
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(
|
|
42043
|
+
currentDirectory,
|
|
42044
|
+
getCanonicalFileName,
|
|
42045
|
+
options,
|
|
42046
|
+
optionsToRedirectsKey
|
|
42047
|
+
);
|
|
42010
42048
|
const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
|
|
42011
42049
|
currentDirectory,
|
|
42012
42050
|
getCanonicalFileName,
|
|
42013
42051
|
options,
|
|
42014
|
-
getResolvedFileName
|
|
42052
|
+
getResolvedFileName,
|
|
42053
|
+
optionsToRedirectsKey
|
|
42015
42054
|
);
|
|
42016
42055
|
packageJsonInfoCache ?? (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
42017
42056
|
return {
|
|
@@ -42021,7 +42060,8 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
|
|
|
42021
42060
|
clear: clear2,
|
|
42022
42061
|
update,
|
|
42023
42062
|
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
42024
|
-
clearAllExceptPackageJsonInfoCache
|
|
42063
|
+
clearAllExceptPackageJsonInfoCache,
|
|
42064
|
+
optionsToRedirectsKey
|
|
42025
42065
|
};
|
|
42026
42066
|
function clear2() {
|
|
42027
42067
|
clearAllExceptPackageJsonInfoCache();
|
|
@@ -42036,24 +42076,26 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
|
|
|
42036
42076
|
nonRelativeNameResolutionCache.update(options2);
|
|
42037
42077
|
}
|
|
42038
42078
|
}
|
|
42039
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
42079
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
|
|
42040
42080
|
const result = createModuleOrTypeReferenceResolutionCache(
|
|
42041
42081
|
currentDirectory,
|
|
42042
42082
|
getCanonicalFileName,
|
|
42043
42083
|
options,
|
|
42044
42084
|
packageJsonInfoCache,
|
|
42045
|
-
getOriginalOrResolvedModuleFileName
|
|
42085
|
+
getOriginalOrResolvedModuleFileName,
|
|
42086
|
+
optionsToRedirectsKey
|
|
42046
42087
|
);
|
|
42047
42088
|
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
42048
42089
|
return result;
|
|
42049
42090
|
}
|
|
42050
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
42091
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
|
|
42051
42092
|
return createModuleOrTypeReferenceResolutionCache(
|
|
42052
42093
|
currentDirectory,
|
|
42053
42094
|
getCanonicalFileName,
|
|
42054
42095
|
options,
|
|
42055
42096
|
packageJsonInfoCache,
|
|
42056
|
-
getOriginalOrResolvedTypeReferenceFileName
|
|
42097
|
+
getOriginalOrResolvedTypeReferenceFileName,
|
|
42098
|
+
optionsToRedirectsKey
|
|
42057
42099
|
);
|
|
42058
42100
|
}
|
|
42059
42101
|
function getOptionsForLibraryResolution(options) {
|
|
@@ -53860,7 +53902,14 @@ function createTypeChecker(host) {
|
|
|
53860
53902
|
}
|
|
53861
53903
|
function isStringNamed(d) {
|
|
53862
53904
|
const name = getNameOfDeclaration(d);
|
|
53863
|
-
|
|
53905
|
+
if (!name) {
|
|
53906
|
+
return false;
|
|
53907
|
+
}
|
|
53908
|
+
if (isComputedPropertyName(name)) {
|
|
53909
|
+
const type = checkExpression(name.expression);
|
|
53910
|
+
return !!(type.flags & 402653316 /* StringLike */);
|
|
53911
|
+
}
|
|
53912
|
+
return isStringLiteral(name);
|
|
53864
53913
|
}
|
|
53865
53914
|
function isSingleQuotedStringNamed(d) {
|
|
53866
53915
|
const name = getNameOfDeclaration(d);
|
|
@@ -56992,7 +57041,7 @@ function createTypeChecker(host) {
|
|
|
56992
57041
|
return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
|
|
56993
57042
|
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
|
56994
57043
|
symbol.links.writeType || symbol.links.type
|
|
56995
|
-
) : getTypeOfSymbol(symbol);
|
|
57044
|
+
) : removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & 16777216 /* Optional */));
|
|
56996
57045
|
}
|
|
56997
57046
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
56998
57047
|
return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
|
|
@@ -68203,7 +68252,6 @@ function createTypeChecker(host) {
|
|
|
68203
68252
|
let bivariant = false;
|
|
68204
68253
|
let propagationType;
|
|
68205
68254
|
let inferencePriority = 2048 /* MaxValue */;
|
|
68206
|
-
let allowComplexConstraintInference = true;
|
|
68207
68255
|
let visited;
|
|
68208
68256
|
let sourceStack;
|
|
68209
68257
|
let targetStack;
|
|
@@ -68358,8 +68406,7 @@ function createTypeChecker(host) {
|
|
|
68358
68406
|
source = getReducedType(source);
|
|
68359
68407
|
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
|
|
68360
68408
|
const apparentSource = getApparentType(source);
|
|
68361
|
-
if (apparentSource !== source &&
|
|
68362
|
-
allowComplexConstraintInference = false;
|
|
68409
|
+
if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
68363
68410
|
return inferFromTypes(apparentSource, target);
|
|
68364
68411
|
}
|
|
68365
68412
|
source = apparentSource;
|
|
@@ -70003,10 +70050,11 @@ function createTypeChecker(host) {
|
|
|
70003
70050
|
const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
|
|
70004
70051
|
return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
|
|
70005
70052
|
}
|
|
70006
|
-
|
|
70007
|
-
|
|
70053
|
+
const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
|
|
70054
|
+
if (t.flags & 1048576 /* Union */) {
|
|
70055
|
+
return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
|
|
70008
70056
|
}
|
|
70009
|
-
return
|
|
70057
|
+
return t;
|
|
70010
70058
|
}
|
|
70011
70059
|
if (containsMatchingReference(reference, node)) {
|
|
70012
70060
|
if (!isReachableFlowNode(flow)) {
|
|
@@ -70869,7 +70917,15 @@ function createTypeChecker(host) {
|
|
|
70869
70917
|
location = location.parent;
|
|
70870
70918
|
}
|
|
70871
70919
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
70872
|
-
const type = removeOptionalTypeMarker(
|
|
70920
|
+
const type = removeOptionalTypeMarker(
|
|
70921
|
+
isWriteAccess(location) && location.kind === 211 /* PropertyAccessExpression */ ? checkPropertyAccessExpression(
|
|
70922
|
+
location,
|
|
70923
|
+
/*checkMode*/
|
|
70924
|
+
void 0,
|
|
70925
|
+
/*writeOnly*/
|
|
70926
|
+
true
|
|
70927
|
+
) : getTypeOfExpression(location)
|
|
70928
|
+
);
|
|
70873
70929
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
70874
70930
|
return type;
|
|
70875
70931
|
}
|
|
@@ -71130,7 +71186,7 @@ function createTypeChecker(host) {
|
|
|
71130
71186
|
const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
|
|
71131
71187
|
if (localOrExportSymbol.flags & 3 /* Variable */) {
|
|
71132
71188
|
if (assignmentKind === 1 /* Definite */) {
|
|
71133
|
-
return type;
|
|
71189
|
+
return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
|
|
71134
71190
|
}
|
|
71135
71191
|
} else if (isAlias) {
|
|
71136
71192
|
declaration = getDeclarationOfAliasSymbol(symbol);
|
|
@@ -72225,8 +72281,19 @@ function createTypeChecker(host) {
|
|
|
72225
72281
|
contextualType,
|
|
72226
72282
|
concatenate(
|
|
72227
72283
|
map(
|
|
72228
|
-
filter(node.properties, (p) =>
|
|
72229
|
-
|
|
72284
|
+
filter(node.properties, (p) => {
|
|
72285
|
+
if (!p.symbol) {
|
|
72286
|
+
return false;
|
|
72287
|
+
}
|
|
72288
|
+
if (p.kind === 303 /* PropertyAssignment */) {
|
|
72289
|
+
return isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
72290
|
+
}
|
|
72291
|
+
if (p.kind === 304 /* ShorthandPropertyAssignment */) {
|
|
72292
|
+
return isDiscriminantProperty(contextualType, p.symbol.escapedName);
|
|
72293
|
+
}
|
|
72294
|
+
return false;
|
|
72295
|
+
}),
|
|
72296
|
+
(prop) => [() => getContextFreeTypeOfExpression(prop.kind === 303 /* PropertyAssignment */ ? prop.initializer : prop.name), prop.symbol.escapedName]
|
|
72230
72297
|
),
|
|
72231
72298
|
map(
|
|
72232
72299
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
@@ -120468,7 +120535,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120468
120535
|
getCanonicalFileName,
|
|
120469
120536
|
/*options*/
|
|
120470
120537
|
void 0,
|
|
120471
|
-
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
|
|
120538
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
|
|
120539
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.optionsToRedirectsKey
|
|
120472
120540
|
);
|
|
120473
120541
|
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
120474
120542
|
typeDirectiveNames,
|
|
@@ -125518,7 +125586,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125518
125586
|
getCurrentDirectory(),
|
|
125519
125587
|
resolutionHost.getCanonicalFileName,
|
|
125520
125588
|
resolutionHost.getCompilationSettings(),
|
|
125521
|
-
moduleResolutionCache.getPackageJsonInfoCache()
|
|
125589
|
+
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
125590
|
+
moduleResolutionCache.optionsToRedirectsKey
|
|
125522
125591
|
);
|
|
125523
125592
|
const resolvedLibraries = /* @__PURE__ */ new Map();
|
|
125524
125593
|
const libraryResolutionCache = createModuleResolutionCache(
|
|
@@ -127868,7 +127937,8 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
127868
127937
|
compilerHost.getCanonicalFileName,
|
|
127869
127938
|
/*options*/
|
|
127870
127939
|
void 0,
|
|
127871
|
-
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
|
|
127940
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(),
|
|
127941
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.optionsToRedirectsKey
|
|
127872
127942
|
);
|
|
127873
127943
|
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
127874
127944
|
typeDirectiveNames,
|
|
@@ -147646,8 +147716,8 @@ registerCodeFix({
|
|
|
147646
147716
|
fixIds: [fixId7],
|
|
147647
147717
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes7, (changes, diag2) => makeChange7(changes, diag2.file, diag2.start))
|
|
147648
147718
|
});
|
|
147649
|
-
function makeChange7(changeTracker, sourceFile,
|
|
147650
|
-
const token = getTokenAtPosition(sourceFile,
|
|
147719
|
+
function makeChange7(changeTracker, sourceFile, start2) {
|
|
147720
|
+
const token = getTokenAtPosition(sourceFile, start2);
|
|
147651
147721
|
const param = token.parent;
|
|
147652
147722
|
if (!isParameter(param)) {
|
|
147653
147723
|
return Debug.fail("Tried to add a parameter name to a non-parameter: " + Debug.formatSyntaxKind(token.kind));
|
|
@@ -147655,20 +147725,34 @@ function makeChange7(changeTracker, sourceFile, pos) {
|
|
|
147655
147725
|
const i = param.parent.parameters.indexOf(param);
|
|
147656
147726
|
Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
|
|
147657
147727
|
Debug.assert(i > -1, "Parameter not found in parent parameter list.");
|
|
147658
|
-
|
|
147728
|
+
let end = param.name.getEnd();
|
|
147729
|
+
let typeNode = factory.createTypeReferenceNode(
|
|
147659
147730
|
param.name,
|
|
147660
147731
|
/*typeArguments*/
|
|
147661
147732
|
void 0
|
|
147662
147733
|
);
|
|
147734
|
+
let nextParam = tryGetNextParam(sourceFile, param);
|
|
147735
|
+
while (nextParam) {
|
|
147736
|
+
typeNode = factory.createArrayTypeNode(typeNode);
|
|
147737
|
+
end = nextParam.getEnd();
|
|
147738
|
+
nextParam = tryGetNextParam(sourceFile, nextParam);
|
|
147739
|
+
}
|
|
147663
147740
|
const replacement = factory.createParameterDeclaration(
|
|
147664
147741
|
param.modifiers,
|
|
147665
147742
|
param.dotDotDotToken,
|
|
147666
147743
|
"arg" + i,
|
|
147667
147744
|
param.questionToken,
|
|
147668
|
-
param.dotDotDotToken ? factory.createArrayTypeNode(typeNode) : typeNode,
|
|
147745
|
+
param.dotDotDotToken && !isArrayTypeNode(typeNode) ? factory.createArrayTypeNode(typeNode) : typeNode,
|
|
147669
147746
|
param.initializer
|
|
147670
147747
|
);
|
|
147671
|
-
changeTracker.
|
|
147748
|
+
changeTracker.replaceRange(sourceFile, createRange(param.getStart(sourceFile), end), replacement);
|
|
147749
|
+
}
|
|
147750
|
+
function tryGetNextParam(sourceFile, param) {
|
|
147751
|
+
const nextToken = findNextToken(param.name, param.parent, sourceFile);
|
|
147752
|
+
if (nextToken && nextToken.kind === 23 /* OpenBracketToken */ && isArrayBindingPattern(nextToken.parent) && isParameter(nextToken.parent.parent)) {
|
|
147753
|
+
return nextToken.parent.parent;
|
|
147754
|
+
}
|
|
147755
|
+
return void 0;
|
|
147672
147756
|
}
|
|
147673
147757
|
|
|
147674
147758
|
// src/services/codefixes/addOptionalPropertyUndefined.ts
|
|
@@ -164883,11 +164967,12 @@ function provideInlayHints(context) {
|
|
|
164883
164967
|
if (!signature || !candidates.length) {
|
|
164884
164968
|
return;
|
|
164885
164969
|
}
|
|
164886
|
-
let signatureParamPos = 0;
|
|
164887
164970
|
const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
|
|
164971
|
+
let signatureParamPos = 0;
|
|
164888
164972
|
for (const originalArg of args) {
|
|
164889
164973
|
const arg = skipParentheses(originalArg);
|
|
164890
164974
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
164975
|
+
signatureParamPos++;
|
|
164891
164976
|
continue;
|
|
164892
164977
|
}
|
|
164893
164978
|
let spreadArgs = 0;
|
|
@@ -173468,6 +173553,7 @@ __export(ts_exports2, {
|
|
|
173468
173553
|
isImportTypeNode: () => isImportTypeNode,
|
|
173469
173554
|
isImportableFile: () => isImportableFile,
|
|
173470
173555
|
isInComment: () => isInComment,
|
|
173556
|
+
isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
|
|
173471
173557
|
isInExpressionContext: () => isInExpressionContext,
|
|
173472
173558
|
isInJSDoc: () => isInJSDoc,
|
|
173473
173559
|
isInJSFile: () => isInJSFile,
|
|
@@ -173761,6 +173847,7 @@ __export(ts_exports2, {
|
|
|
173761
173847
|
isSetAccessor: () => isSetAccessor,
|
|
173762
173848
|
isSetAccessorDeclaration: () => isSetAccessorDeclaration,
|
|
173763
173849
|
isShebangTrivia: () => isShebangTrivia,
|
|
173850
|
+
isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
|
|
173764
173851
|
isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
|
|
173765
173852
|
isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
|
|
173766
173853
|
isSignedNumericLiteral: () => isSignedNumericLiteral,
|
|
@@ -187997,6 +188084,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187997
188084
|
isImportTypeNode,
|
|
187998
188085
|
isImportableFile,
|
|
187999
188086
|
isInComment,
|
|
188087
|
+
isInCompoundLikeAssignment,
|
|
188000
188088
|
isInExpressionContext,
|
|
188001
188089
|
isInJSDoc,
|
|
188002
188090
|
isInJSFile,
|
|
@@ -188290,6 +188378,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188290
188378
|
isSetAccessor,
|
|
188291
188379
|
isSetAccessorDeclaration,
|
|
188292
188380
|
isShebangTrivia,
|
|
188381
|
+
isShiftOperatorOrHigher,
|
|
188293
188382
|
isShorthandAmbientModuleSymbol,
|
|
188294
188383
|
isShorthandPropertyAssignment,
|
|
188295
188384
|
isSignedNumericLiteral,
|