@typescript-deploys/pr-build 5.0.0-pr-52710-9 → 5.0.0-pr-52734-9
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 +62 -47
- package/lib/tsserver.js +85 -62
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +85 -62
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +85 -62
- package/lib/typingsInstaller.js +5 -22
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230213`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -27092,13 +27092,8 @@ var Parser;
|
|
|
27092
27092
|
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
|
|
27093
27093
|
case 14 /* JsxChildren */:
|
|
27094
27094
|
return true;
|
|
27095
|
-
case 25 /* StandaloneJSDoc */:
|
|
27096
|
-
return true;
|
|
27097
|
-
case 26 /* Count */:
|
|
27098
|
-
return Debug.fail("ParsingContext.Count used as a context");
|
|
27099
|
-
default:
|
|
27100
|
-
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
|
|
27101
27095
|
}
|
|
27096
|
+
return Debug.fail("Non-exhaustive case in 'isListElement'.");
|
|
27102
27097
|
}
|
|
27103
27098
|
function isValidHeritageClauseObjectLiteral() {
|
|
27104
27099
|
Debug.assert(token() === 18 /* OpenBraceToken */);
|
|
@@ -27192,8 +27187,7 @@ var Parser;
|
|
|
27192
27187
|
return false;
|
|
27193
27188
|
}
|
|
27194
27189
|
function isInSomeParsingContext() {
|
|
27195
|
-
|
|
27196
|
-
for (let kind = 0; kind < 26 /* Count */; kind++) {
|
|
27190
|
+
for (let kind = 0; kind < 25 /* Count */; kind++) {
|
|
27197
27191
|
if (parsingContext & 1 << kind) {
|
|
27198
27192
|
if (isListElement(
|
|
27199
27193
|
kind,
|
|
@@ -27272,7 +27266,6 @@ var Parser;
|
|
|
27272
27266
|
case 8 /* VariableDeclarations */:
|
|
27273
27267
|
case 17 /* JSDocParameters */:
|
|
27274
27268
|
case 16 /* Parameters */:
|
|
27275
|
-
case 25 /* StandaloneJSDoc */:
|
|
27276
27269
|
return true;
|
|
27277
27270
|
}
|
|
27278
27271
|
return false;
|
|
@@ -27453,9 +27446,7 @@ var Parser;
|
|
|
27453
27446
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27454
27447
|
case 24 /* AssertEntries */:
|
|
27455
27448
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
|
|
27456
|
-
case 25 /*
|
|
27457
|
-
return;
|
|
27458
|
-
case 26 /* Count */:
|
|
27449
|
+
case 25 /* Count */:
|
|
27459
27450
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
27460
27451
|
default:
|
|
27461
27452
|
Debug.assertNever(context);
|
|
@@ -31555,8 +31546,7 @@ var Parser;
|
|
|
31555
31546
|
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
|
|
31556
31547
|
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
|
|
31557
31548
|
ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
|
|
31558
|
-
ParsingContext2[ParsingContext2["
|
|
31559
|
-
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
|
|
31549
|
+
ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
|
|
31560
31550
|
})(ParsingContext || (ParsingContext = {}));
|
|
31561
31551
|
let Tristate;
|
|
31562
31552
|
((Tristate2) => {
|
|
@@ -31678,13 +31668,6 @@ var Parser;
|
|
|
31678
31668
|
PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
|
|
31679
31669
|
})(PropertyLikeParse || (PropertyLikeParse = {}));
|
|
31680
31670
|
function parseJSDocCommentWorker(start = 0, length2) {
|
|
31681
|
-
const saveParsingContext = parsingContext;
|
|
31682
|
-
parsingContext |= 1 << 25 /* StandaloneJSDoc */;
|
|
31683
|
-
const jsdoc = parseJSDocCommentWorkerWorker(start, length2);
|
|
31684
|
-
parsingContext = saveParsingContext;
|
|
31685
|
-
return jsdoc;
|
|
31686
|
-
}
|
|
31687
|
-
function parseJSDocCommentWorkerWorker(start, length2) {
|
|
31688
31671
|
const content = sourceText;
|
|
31689
31672
|
const end = length2 === void 0 ? content.length : start + length2;
|
|
31690
31673
|
length2 = end - start;
|
|
@@ -43312,6 +43295,7 @@ function createTypeChecker(host) {
|
|
|
43312
43295
|
let flowTypeCache;
|
|
43313
43296
|
const contextualTypeNodes = [];
|
|
43314
43297
|
const contextualTypes = [];
|
|
43298
|
+
const contextualIsCache = [];
|
|
43315
43299
|
let contextualTypeCount = 0;
|
|
43316
43300
|
const inferenceContextNodes = [];
|
|
43317
43301
|
const inferenceContexts = [];
|
|
@@ -58273,7 +58257,12 @@ function createTypeChecker(host) {
|
|
|
58273
58257
|
}
|
|
58274
58258
|
}
|
|
58275
58259
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
58276
|
-
pushContextualType(
|
|
58260
|
+
pushContextualType(
|
|
58261
|
+
next,
|
|
58262
|
+
sourcePropType,
|
|
58263
|
+
/*isCache*/
|
|
58264
|
+
false
|
|
58265
|
+
);
|
|
58277
58266
|
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
58278
58267
|
popContextualType();
|
|
58279
58268
|
return result;
|
|
@@ -58581,7 +58570,12 @@ function createTypeChecker(host) {
|
|
|
58581
58570
|
if (isTupleLikeType(source)) {
|
|
58582
58571
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
58583
58572
|
}
|
|
58584
|
-
pushContextualType(
|
|
58573
|
+
pushContextualType(
|
|
58574
|
+
node,
|
|
58575
|
+
target,
|
|
58576
|
+
/*isCache*/
|
|
58577
|
+
false
|
|
58578
|
+
);
|
|
58585
58579
|
const tupleizedType = checkArrayLiteral(
|
|
58586
58580
|
node,
|
|
58587
58581
|
1 /* Contextual */,
|
|
@@ -62496,10 +62490,10 @@ function createTypeChecker(host) {
|
|
|
62496
62490
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
62497
62491
|
}
|
|
62498
62492
|
function isMemberOfStringMapping(source, target) {
|
|
62499
|
-
if (target.flags &
|
|
62493
|
+
if (target.flags & 1 /* Any */) {
|
|
62500
62494
|
return true;
|
|
62501
62495
|
}
|
|
62502
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
62496
|
+
if (target.flags & (4 /* String */ & 134217728 /* TemplateLiteral */)) {
|
|
62503
62497
|
return isTypeAssignableTo(source, target);
|
|
62504
62498
|
}
|
|
62505
62499
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -66630,11 +66624,13 @@ function createTypeChecker(host) {
|
|
|
66630
66624
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
66631
66625
|
return void 0;
|
|
66632
66626
|
}
|
|
66633
|
-
const index = findContextualNode(
|
|
66627
|
+
const index = findContextualNode(
|
|
66628
|
+
node,
|
|
66629
|
+
/*includeCaches*/
|
|
66630
|
+
!contextFlags
|
|
66631
|
+
);
|
|
66634
66632
|
if (index >= 0) {
|
|
66635
|
-
|
|
66636
|
-
if (cached || !contextFlags)
|
|
66637
|
-
return cached;
|
|
66633
|
+
return contextualTypes[index];
|
|
66638
66634
|
}
|
|
66639
66635
|
const { parent } = node;
|
|
66640
66636
|
switch (parent.kind) {
|
|
@@ -66705,17 +66701,30 @@ function createTypeChecker(host) {
|
|
|
66705
66701
|
}
|
|
66706
66702
|
return void 0;
|
|
66707
66703
|
}
|
|
66708
|
-
function
|
|
66704
|
+
function pushCachedContextualType(node) {
|
|
66705
|
+
pushContextualType(
|
|
66706
|
+
node,
|
|
66707
|
+
getContextualType(
|
|
66708
|
+
node,
|
|
66709
|
+
/*contextFlags*/
|
|
66710
|
+
void 0
|
|
66711
|
+
),
|
|
66712
|
+
/*isCache*/
|
|
66713
|
+
true
|
|
66714
|
+
);
|
|
66715
|
+
}
|
|
66716
|
+
function pushContextualType(node, type, isCache) {
|
|
66709
66717
|
contextualTypeNodes[contextualTypeCount] = node;
|
|
66710
66718
|
contextualTypes[contextualTypeCount] = type;
|
|
66719
|
+
contextualIsCache[contextualTypeCount] = isCache;
|
|
66711
66720
|
contextualTypeCount++;
|
|
66712
66721
|
}
|
|
66713
66722
|
function popContextualType() {
|
|
66714
66723
|
contextualTypeCount--;
|
|
66715
66724
|
}
|
|
66716
|
-
function findContextualNode(node) {
|
|
66725
|
+
function findContextualNode(node, includeCaches) {
|
|
66717
66726
|
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
66718
|
-
if (node === contextualTypeNodes[i]) {
|
|
66727
|
+
if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
|
|
66719
66728
|
return i;
|
|
66720
66729
|
}
|
|
66721
66730
|
}
|
|
@@ -66738,7 +66747,11 @@ function createTypeChecker(host) {
|
|
|
66738
66747
|
}
|
|
66739
66748
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
66740
66749
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
66741
|
-
const index = findContextualNode(
|
|
66750
|
+
const index = findContextualNode(
|
|
66751
|
+
node.parent,
|
|
66752
|
+
/*includeCaches*/
|
|
66753
|
+
!contextFlags
|
|
66754
|
+
);
|
|
66742
66755
|
if (index >= 0) {
|
|
66743
66756
|
return contextualTypes[index];
|
|
66744
66757
|
}
|
|
@@ -67009,11 +67022,7 @@ function createTypeChecker(host) {
|
|
|
67009
67022
|
const elementCount = elements.length;
|
|
67010
67023
|
const elementTypes = [];
|
|
67011
67024
|
const elementFlags = [];
|
|
67012
|
-
|
|
67013
|
-
node,
|
|
67014
|
-
/*contextFlags*/
|
|
67015
|
-
void 0
|
|
67016
|
-
));
|
|
67025
|
+
pushCachedContextualType(node);
|
|
67017
67026
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
67018
67027
|
const inConstContext = isConstContext(node);
|
|
67019
67028
|
const contextualType = getApparentTypeOfContextualType(
|
|
@@ -67176,11 +67185,7 @@ function createTypeChecker(host) {
|
|
|
67176
67185
|
let propertiesTable = createSymbolTable();
|
|
67177
67186
|
let propertiesArray = [];
|
|
67178
67187
|
let spread = emptyObjectType;
|
|
67179
|
-
|
|
67180
|
-
node,
|
|
67181
|
-
/*contextFlags*/
|
|
67182
|
-
void 0
|
|
67183
|
-
));
|
|
67188
|
+
pushCachedContextualType(node);
|
|
67184
67189
|
const contextualType = getApparentTypeOfContextualType(
|
|
67185
67190
|
node,
|
|
67186
67191
|
/*contextFlags*/
|
|
@@ -73191,14 +73196,19 @@ function createTypeChecker(host) {
|
|
|
73191
73196
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
73192
73197
|
}
|
|
73193
73198
|
function getContextNode(node) {
|
|
73194
|
-
if (node
|
|
73199
|
+
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
73195
73200
|
return node.parent.parent;
|
|
73196
73201
|
}
|
|
73197
73202
|
return node;
|
|
73198
73203
|
}
|
|
73199
73204
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
73200
73205
|
const contextNode = getContextNode(node);
|
|
73201
|
-
pushContextualType(
|
|
73206
|
+
pushContextualType(
|
|
73207
|
+
contextNode,
|
|
73208
|
+
contextualType,
|
|
73209
|
+
/*isCache*/
|
|
73210
|
+
false
|
|
73211
|
+
);
|
|
73202
73212
|
pushInferenceContext(contextNode, inferenceContext);
|
|
73203
73213
|
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
73204
73214
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
@@ -73539,7 +73549,12 @@ function createTypeChecker(host) {
|
|
|
73539
73549
|
if (links.contextFreeType) {
|
|
73540
73550
|
return links.contextFreeType;
|
|
73541
73551
|
}
|
|
73542
|
-
pushContextualType(
|
|
73552
|
+
pushContextualType(
|
|
73553
|
+
node,
|
|
73554
|
+
anyType,
|
|
73555
|
+
/*isCache*/
|
|
73556
|
+
false
|
|
73557
|
+
);
|
|
73543
73558
|
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
73544
73559
|
popContextualType();
|
|
73545
73560
|
return type;
|
package/lib/tsserver.js
CHANGED
|
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2287
|
|
|
2288
2288
|
// src/compiler/corePublic.ts
|
|
2289
2289
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2290
|
+
var version = `${versionMajorMinor}.0-insiders.20230213`;
|
|
2291
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -31407,13 +31407,8 @@ var Parser;
|
|
|
31407
31407
|
return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */;
|
|
31408
31408
|
case 14 /* JsxChildren */:
|
|
31409
31409
|
return true;
|
|
31410
|
-
case 25 /* StandaloneJSDoc */:
|
|
31411
|
-
return true;
|
|
31412
|
-
case 26 /* Count */:
|
|
31413
|
-
return Debug.fail("ParsingContext.Count used as a context");
|
|
31414
|
-
default:
|
|
31415
|
-
Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'.");
|
|
31416
31410
|
}
|
|
31411
|
+
return Debug.fail("Non-exhaustive case in 'isListElement'.");
|
|
31417
31412
|
}
|
|
31418
31413
|
function isValidHeritageClauseObjectLiteral() {
|
|
31419
31414
|
Debug.assert(token() === 18 /* OpenBraceToken */);
|
|
@@ -31507,8 +31502,7 @@ var Parser;
|
|
|
31507
31502
|
return false;
|
|
31508
31503
|
}
|
|
31509
31504
|
function isInSomeParsingContext() {
|
|
31510
|
-
|
|
31511
|
-
for (let kind = 0; kind < 26 /* Count */; kind++) {
|
|
31505
|
+
for (let kind = 0; kind < 25 /* Count */; kind++) {
|
|
31512
31506
|
if (parsingContext & 1 << kind) {
|
|
31513
31507
|
if (isListElement2(
|
|
31514
31508
|
kind,
|
|
@@ -31587,7 +31581,6 @@ var Parser;
|
|
|
31587
31581
|
case 8 /* VariableDeclarations */:
|
|
31588
31582
|
case 17 /* JSDocParameters */:
|
|
31589
31583
|
case 16 /* Parameters */:
|
|
31590
|
-
case 25 /* StandaloneJSDoc */:
|
|
31591
31584
|
return true;
|
|
31592
31585
|
}
|
|
31593
31586
|
return false;
|
|
@@ -31768,9 +31761,7 @@ var Parser;
|
|
|
31768
31761
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
31769
31762
|
case 24 /* AssertEntries */:
|
|
31770
31763
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
|
|
31771
|
-
case 25 /*
|
|
31772
|
-
return;
|
|
31773
|
-
case 26 /* Count */:
|
|
31764
|
+
case 25 /* Count */:
|
|
31774
31765
|
return Debug.fail("ParsingContext.Count used as a context");
|
|
31775
31766
|
default:
|
|
31776
31767
|
Debug.assertNever(context);
|
|
@@ -35870,8 +35861,7 @@ var Parser;
|
|
|
35870
35861
|
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
|
|
35871
35862
|
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
|
|
35872
35863
|
ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries";
|
|
35873
|
-
ParsingContext2[ParsingContext2["
|
|
35874
|
-
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
|
|
35864
|
+
ParsingContext2[ParsingContext2["Count"] = 25] = "Count";
|
|
35875
35865
|
})(ParsingContext || (ParsingContext = {}));
|
|
35876
35866
|
let Tristate;
|
|
35877
35867
|
((Tristate2) => {
|
|
@@ -35993,13 +35983,6 @@ var Parser;
|
|
|
35993
35983
|
PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter";
|
|
35994
35984
|
})(PropertyLikeParse || (PropertyLikeParse = {}));
|
|
35995
35985
|
function parseJSDocCommentWorker(start2 = 0, length2) {
|
|
35996
|
-
const saveParsingContext = parsingContext;
|
|
35997
|
-
parsingContext |= 1 << 25 /* StandaloneJSDoc */;
|
|
35998
|
-
const jsdoc = parseJSDocCommentWorkerWorker(start2, length2);
|
|
35999
|
-
parsingContext = saveParsingContext;
|
|
36000
|
-
return jsdoc;
|
|
36001
|
-
}
|
|
36002
|
-
function parseJSDocCommentWorkerWorker(start2, length2) {
|
|
36003
35986
|
const content = sourceText;
|
|
36004
35987
|
const end = length2 === void 0 ? content.length : start2 + length2;
|
|
36005
35988
|
length2 = end - start2;
|
|
@@ -47888,6 +47871,7 @@ function createTypeChecker(host) {
|
|
|
47888
47871
|
let flowTypeCache;
|
|
47889
47872
|
const contextualTypeNodes = [];
|
|
47890
47873
|
const contextualTypes = [];
|
|
47874
|
+
const contextualIsCache = [];
|
|
47891
47875
|
let contextualTypeCount = 0;
|
|
47892
47876
|
const inferenceContextNodes = [];
|
|
47893
47877
|
const inferenceContexts = [];
|
|
@@ -62849,7 +62833,12 @@ function createTypeChecker(host) {
|
|
|
62849
62833
|
}
|
|
62850
62834
|
}
|
|
62851
62835
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
62852
|
-
pushContextualType(
|
|
62836
|
+
pushContextualType(
|
|
62837
|
+
next,
|
|
62838
|
+
sourcePropType,
|
|
62839
|
+
/*isCache*/
|
|
62840
|
+
false
|
|
62841
|
+
);
|
|
62853
62842
|
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
62854
62843
|
popContextualType();
|
|
62855
62844
|
return result;
|
|
@@ -63157,7 +63146,12 @@ function createTypeChecker(host) {
|
|
|
63157
63146
|
if (isTupleLikeType(source)) {
|
|
63158
63147
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
63159
63148
|
}
|
|
63160
|
-
pushContextualType(
|
|
63149
|
+
pushContextualType(
|
|
63150
|
+
node,
|
|
63151
|
+
target,
|
|
63152
|
+
/*isCache*/
|
|
63153
|
+
false
|
|
63154
|
+
);
|
|
63161
63155
|
const tupleizedType = checkArrayLiteral(
|
|
63162
63156
|
node,
|
|
63163
63157
|
1 /* Contextual */,
|
|
@@ -67072,10 +67066,10 @@ function createTypeChecker(host) {
|
|
|
67072
67066
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
67073
67067
|
}
|
|
67074
67068
|
function isMemberOfStringMapping(source, target) {
|
|
67075
|
-
if (target.flags &
|
|
67069
|
+
if (target.flags & 1 /* Any */) {
|
|
67076
67070
|
return true;
|
|
67077
67071
|
}
|
|
67078
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
67072
|
+
if (target.flags & (4 /* String */ & 134217728 /* TemplateLiteral */)) {
|
|
67079
67073
|
return isTypeAssignableTo(source, target);
|
|
67080
67074
|
}
|
|
67081
67075
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -71206,11 +71200,13 @@ function createTypeChecker(host) {
|
|
|
71206
71200
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
71207
71201
|
return void 0;
|
|
71208
71202
|
}
|
|
71209
|
-
const index = findContextualNode(
|
|
71203
|
+
const index = findContextualNode(
|
|
71204
|
+
node,
|
|
71205
|
+
/*includeCaches*/
|
|
71206
|
+
!contextFlags
|
|
71207
|
+
);
|
|
71210
71208
|
if (index >= 0) {
|
|
71211
|
-
|
|
71212
|
-
if (cached || !contextFlags)
|
|
71213
|
-
return cached;
|
|
71209
|
+
return contextualTypes[index];
|
|
71214
71210
|
}
|
|
71215
71211
|
const { parent: parent2 } = node;
|
|
71216
71212
|
switch (parent2.kind) {
|
|
@@ -71281,17 +71277,30 @@ function createTypeChecker(host) {
|
|
|
71281
71277
|
}
|
|
71282
71278
|
return void 0;
|
|
71283
71279
|
}
|
|
71284
|
-
function
|
|
71280
|
+
function pushCachedContextualType(node) {
|
|
71281
|
+
pushContextualType(
|
|
71282
|
+
node,
|
|
71283
|
+
getContextualType2(
|
|
71284
|
+
node,
|
|
71285
|
+
/*contextFlags*/
|
|
71286
|
+
void 0
|
|
71287
|
+
),
|
|
71288
|
+
/*isCache*/
|
|
71289
|
+
true
|
|
71290
|
+
);
|
|
71291
|
+
}
|
|
71292
|
+
function pushContextualType(node, type, isCache) {
|
|
71285
71293
|
contextualTypeNodes[contextualTypeCount] = node;
|
|
71286
71294
|
contextualTypes[contextualTypeCount] = type;
|
|
71295
|
+
contextualIsCache[contextualTypeCount] = isCache;
|
|
71287
71296
|
contextualTypeCount++;
|
|
71288
71297
|
}
|
|
71289
71298
|
function popContextualType() {
|
|
71290
71299
|
contextualTypeCount--;
|
|
71291
71300
|
}
|
|
71292
|
-
function findContextualNode(node) {
|
|
71301
|
+
function findContextualNode(node, includeCaches) {
|
|
71293
71302
|
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
71294
|
-
if (node === contextualTypeNodes[i]) {
|
|
71303
|
+
if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
|
|
71295
71304
|
return i;
|
|
71296
71305
|
}
|
|
71297
71306
|
}
|
|
@@ -71314,7 +71323,11 @@ function createTypeChecker(host) {
|
|
|
71314
71323
|
}
|
|
71315
71324
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
71316
71325
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
71317
|
-
const index = findContextualNode(
|
|
71326
|
+
const index = findContextualNode(
|
|
71327
|
+
node.parent,
|
|
71328
|
+
/*includeCaches*/
|
|
71329
|
+
!contextFlags
|
|
71330
|
+
);
|
|
71318
71331
|
if (index >= 0) {
|
|
71319
71332
|
return contextualTypes[index];
|
|
71320
71333
|
}
|
|
@@ -71585,11 +71598,7 @@ function createTypeChecker(host) {
|
|
|
71585
71598
|
const elementCount = elements.length;
|
|
71586
71599
|
const elementTypes = [];
|
|
71587
71600
|
const elementFlags = [];
|
|
71588
|
-
|
|
71589
|
-
node,
|
|
71590
|
-
/*contextFlags*/
|
|
71591
|
-
void 0
|
|
71592
|
-
));
|
|
71601
|
+
pushCachedContextualType(node);
|
|
71593
71602
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71594
71603
|
const inConstContext = isConstContext(node);
|
|
71595
71604
|
const contextualType = getApparentTypeOfContextualType(
|
|
@@ -71752,11 +71761,7 @@ function createTypeChecker(host) {
|
|
|
71752
71761
|
let propertiesTable = createSymbolTable();
|
|
71753
71762
|
let propertiesArray = [];
|
|
71754
71763
|
let spread = emptyObjectType;
|
|
71755
|
-
|
|
71756
|
-
node,
|
|
71757
|
-
/*contextFlags*/
|
|
71758
|
-
void 0
|
|
71759
|
-
));
|
|
71764
|
+
pushCachedContextualType(node);
|
|
71760
71765
|
const contextualType = getApparentTypeOfContextualType(
|
|
71761
71766
|
node,
|
|
71762
71767
|
/*contextFlags*/
|
|
@@ -77767,14 +77772,19 @@ function createTypeChecker(host) {
|
|
|
77767
77772
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
77768
77773
|
}
|
|
77769
77774
|
function getContextNode2(node) {
|
|
77770
|
-
if (node
|
|
77775
|
+
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
77771
77776
|
return node.parent.parent;
|
|
77772
77777
|
}
|
|
77773
77778
|
return node;
|
|
77774
77779
|
}
|
|
77775
77780
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
77776
77781
|
const contextNode = getContextNode2(node);
|
|
77777
|
-
pushContextualType(
|
|
77782
|
+
pushContextualType(
|
|
77783
|
+
contextNode,
|
|
77784
|
+
contextualType,
|
|
77785
|
+
/*isCache*/
|
|
77786
|
+
false
|
|
77787
|
+
);
|
|
77778
77788
|
pushInferenceContext(contextNode, inferenceContext);
|
|
77779
77789
|
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
77780
77790
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
@@ -78115,7 +78125,12 @@ function createTypeChecker(host) {
|
|
|
78115
78125
|
if (links.contextFreeType) {
|
|
78116
78126
|
return links.contextFreeType;
|
|
78117
78127
|
}
|
|
78118
|
-
pushContextualType(
|
|
78128
|
+
pushContextualType(
|
|
78129
|
+
node,
|
|
78130
|
+
anyType,
|
|
78131
|
+
/*isCache*/
|
|
78132
|
+
false
|
|
78133
|
+
);
|
|
78119
78134
|
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
78120
78135
|
popContextualType();
|
|
78121
78136
|
return type;
|
|
@@ -141248,6 +141263,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141248
141263
|
sourceFile,
|
|
141249
141264
|
symbol,
|
|
141250
141265
|
symbolName2,
|
|
141266
|
+
moduleSymbol,
|
|
141251
141267
|
/*isJsxTagName*/
|
|
141252
141268
|
false,
|
|
141253
141269
|
program,
|
|
@@ -141259,7 +141275,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141259
141275
|
const fix = getImportFixForSymbol(
|
|
141260
141276
|
sourceFile,
|
|
141261
141277
|
Debug.checkDefined(exportInfo),
|
|
141262
|
-
moduleSymbol,
|
|
141263
141278
|
program,
|
|
141264
141279
|
/*position*/
|
|
141265
141280
|
void 0,
|
|
@@ -141437,13 +141452,19 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
|
|
|
141437
141452
|
return result && { ...result, computedWithoutCacheCount };
|
|
141438
141453
|
}
|
|
141439
141454
|
}
|
|
141440
|
-
function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
141455
|
+
function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
141441
141456
|
const compilerOptions = program.getCompilerOptions();
|
|
141442
|
-
|
|
141443
|
-
|
|
141457
|
+
let exportInfos;
|
|
141458
|
+
if (exportMapKey) {
|
|
141459
|
+
exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
|
|
141460
|
+
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
|
|
141461
|
+
} else {
|
|
141462
|
+
exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
|
|
141463
|
+
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
|
|
141464
|
+
}
|
|
141444
141465
|
const useRequire = shouldUseRequire(sourceFile, program);
|
|
141445
141466
|
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
|
|
141446
|
-
const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos,
|
|
141467
|
+
const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
141447
141468
|
return {
|
|
141448
141469
|
moduleSpecifier: fix.moduleSpecifier,
|
|
141449
141470
|
codeAction: codeFixActionToCodeAction(codeActionForFix(
|
|
@@ -141465,23 +141486,22 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
|
|
|
141465
141486
|
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
|
|
141466
141487
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
|
|
141467
141488
|
}
|
|
141468
|
-
function getImportFixForSymbol(sourceFile, exportInfos,
|
|
141469
|
-
Debug.assert(exportInfos.some((info) => info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol), "Some exportInfo should match the specified moduleSymbol");
|
|
141489
|
+
function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
141470
141490
|
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
141471
141491
|
return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
|
|
141472
141492
|
}
|
|
141473
141493
|
function codeFixActionToCodeAction({ description: description2, changes, commands }) {
|
|
141474
141494
|
return { description: description2, changes, commands };
|
|
141475
141495
|
}
|
|
141476
|
-
function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
|
|
141496
|
+
function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
|
|
141477
141497
|
const getChecker = createGetChecker(program, host);
|
|
141478
141498
|
return getExportInfoMap(importingFile, host, program, preferences, cancellationToken).search(importingFile.path, preferCapitalized, (name) => name === symbolName2, (info) => {
|
|
141479
|
-
if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) {
|
|
141499
|
+
if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
|
|
141480
141500
|
return info;
|
|
141481
141501
|
}
|
|
141482
141502
|
});
|
|
141483
141503
|
}
|
|
141484
|
-
function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
|
|
141504
|
+
function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
|
|
141485
141505
|
var _a2, _b;
|
|
141486
141506
|
const compilerOptions = program.getCompilerOptions();
|
|
141487
141507
|
const mainProgramInfo = getInfoWithChecker(
|
|
@@ -141503,7 +141523,7 @@ function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
|
|
|
141503
141523
|
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
|
|
141504
141524
|
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
|
|
141505
141525
|
}
|
|
141506
|
-
const named = checker.tryGetMemberInModuleExportsAndProperties(
|
|
141526
|
+
const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
|
|
141507
141527
|
if (named && skipAlias(named, checker) === symbol) {
|
|
141508
141528
|
return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
|
|
141509
141529
|
}
|
|
@@ -149162,6 +149182,7 @@ function originToCompletionEntryData(origin) {
|
|
|
149162
149182
|
if (originIsResolvedExport(origin)) {
|
|
149163
149183
|
const resolvedData = {
|
|
149164
149184
|
exportName: origin.exportName,
|
|
149185
|
+
exportMapKey: origin.exportMapKey,
|
|
149165
149186
|
moduleSpecifier: origin.moduleSpecifier,
|
|
149166
149187
|
ambientModuleName,
|
|
149167
149188
|
fileName: origin.fileName,
|
|
@@ -149185,6 +149206,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
149185
149206
|
const resolvedOrigin = {
|
|
149186
149207
|
kind: 32 /* ResolvedExport */,
|
|
149187
149208
|
exportName: data.exportName,
|
|
149209
|
+
exportMapKey: data.exportMapKey,
|
|
149188
149210
|
moduleSpecifier: data.moduleSpecifier,
|
|
149189
149211
|
symbolName: completionName,
|
|
149190
149212
|
fileName: data.fileName,
|
|
@@ -149563,6 +149585,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
149563
149585
|
const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
|
|
149564
149586
|
targetSymbol,
|
|
149565
149587
|
moduleSymbol,
|
|
149588
|
+
data == null ? void 0 : data.exportMapKey,
|
|
149566
149589
|
sourceFile,
|
|
149567
149590
|
name,
|
|
149568
149591
|
isJsxOpeningTagName,
|
|
@@ -150261,16 +150284,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150261
150284
|
if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
|
|
150262
150285
|
return;
|
|
150263
150286
|
}
|
|
150264
|
-
|
|
150265
|
-
if (!
|
|
150287
|
+
info = filter(info, isImportableExportInfo);
|
|
150288
|
+
if (!info.length) {
|
|
150266
150289
|
return;
|
|
150267
150290
|
}
|
|
150268
150291
|
const result = context.tryResolve(info, isFromAmbientModule) || {};
|
|
150269
150292
|
if (result === "failed")
|
|
150270
150293
|
return;
|
|
150271
|
-
let exportInfo2 =
|
|
150294
|
+
let exportInfo2 = info[0], moduleSpecifier;
|
|
150272
150295
|
if (result !== "skipped") {
|
|
150273
|
-
({ exportInfo: exportInfo2 =
|
|
150296
|
+
({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
|
|
150274
150297
|
}
|
|
150275
150298
|
const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
|
|
150276
150299
|
const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -10590,6 +10590,7 @@ declare namespace ts {
|
|
|
10590
10590
|
* in the case of InternalSymbolName.ExportEquals and InternalSymbolName.Default.
|
|
10591
10591
|
*/
|
|
10592
10592
|
exportName: string;
|
|
10593
|
+
exportMapKey?: string;
|
|
10593
10594
|
moduleSpecifier?: string;
|
|
10594
10595
|
/** The file name declaring the export's module symbol, if it was an external module */
|
|
10595
10596
|
fileName?: string;
|
|
@@ -10599,7 +10600,6 @@ declare namespace ts {
|
|
|
10599
10600
|
isPackageJsonImport?: true;
|
|
10600
10601
|
}
|
|
10601
10602
|
interface CompletionEntryDataUnresolved extends CompletionEntryDataAutoImport {
|
|
10602
|
-
/** The key in the `ExportMapCache` where the completion entry's `SymbolExportInfo[]` is found */
|
|
10603
10603
|
exportMapKey: string;
|
|
10604
10604
|
}
|
|
10605
10605
|
interface CompletionEntryDataResolved extends CompletionEntryDataAutoImport {
|