@typescript-deploys/pr-build 5.0.0-pr-52710-9 → 5.0.0-pr-52696-39
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 +80 -53
- package/lib/tsserver.js +103 -68
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +103 -68
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +103 -68
- 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.20230211`;
|
|
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 = [];
|
|
@@ -50482,6 +50466,8 @@ function createTypeChecker(host) {
|
|
|
50482
50466
|
return !!target.baseTypesResolved;
|
|
50483
50467
|
case 8 /* WriteType */:
|
|
50484
50468
|
return !!getSymbolLinks(target).writeType;
|
|
50469
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
50470
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
50485
50471
|
}
|
|
50486
50472
|
return Debug.assertNever(propertyName);
|
|
50487
50473
|
}
|
|
@@ -58273,7 +58259,12 @@ function createTypeChecker(host) {
|
|
|
58273
58259
|
}
|
|
58274
58260
|
}
|
|
58275
58261
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
58276
|
-
pushContextualType(
|
|
58262
|
+
pushContextualType(
|
|
58263
|
+
next,
|
|
58264
|
+
sourcePropType,
|
|
58265
|
+
/*isCache*/
|
|
58266
|
+
false
|
|
58267
|
+
);
|
|
58277
58268
|
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
58278
58269
|
popContextualType();
|
|
58279
58270
|
return result;
|
|
@@ -58581,7 +58572,12 @@ function createTypeChecker(host) {
|
|
|
58581
58572
|
if (isTupleLikeType(source)) {
|
|
58582
58573
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
58583
58574
|
}
|
|
58584
|
-
pushContextualType(
|
|
58575
|
+
pushContextualType(
|
|
58576
|
+
node,
|
|
58577
|
+
target,
|
|
58578
|
+
/*isCache*/
|
|
58579
|
+
false
|
|
58580
|
+
);
|
|
58585
58581
|
const tupleizedType = checkArrayLiteral(
|
|
58586
58582
|
node,
|
|
58587
58583
|
1 /* Contextual */,
|
|
@@ -65304,15 +65300,25 @@ function createTypeChecker(host) {
|
|
|
65304
65300
|
function isConstVariable(symbol) {
|
|
65305
65301
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
65306
65302
|
}
|
|
65307
|
-
function
|
|
65308
|
-
|
|
65309
|
-
|
|
65310
|
-
|
|
65311
|
-
|
|
65312
|
-
|
|
65313
|
-
|
|
65314
|
-
|
|
65303
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
65304
|
+
const links = getNodeLinks(declaration);
|
|
65305
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
65306
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
65307
|
+
reportCircularityError(declaration.symbol);
|
|
65308
|
+
return true;
|
|
65309
|
+
}
|
|
65310
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
65311
|
+
if (!popTypeResolution()) {
|
|
65312
|
+
reportCircularityError(declaration.symbol);
|
|
65313
|
+
return true;
|
|
65314
|
+
}
|
|
65315
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
65315
65316
|
}
|
|
65317
|
+
return links.parameterInitializerContainsUndefined;
|
|
65318
|
+
}
|
|
65319
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
65320
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
65321
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
65316
65322
|
}
|
|
65317
65323
|
function isConstraintPosition(type, node) {
|
|
65318
65324
|
const parent = node.parent;
|
|
@@ -66630,11 +66636,13 @@ function createTypeChecker(host) {
|
|
|
66630
66636
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
66631
66637
|
return void 0;
|
|
66632
66638
|
}
|
|
66633
|
-
const index = findContextualNode(
|
|
66639
|
+
const index = findContextualNode(
|
|
66640
|
+
node,
|
|
66641
|
+
/*includeCaches*/
|
|
66642
|
+
!contextFlags
|
|
66643
|
+
);
|
|
66634
66644
|
if (index >= 0) {
|
|
66635
|
-
|
|
66636
|
-
if (cached || !contextFlags)
|
|
66637
|
-
return cached;
|
|
66645
|
+
return contextualTypes[index];
|
|
66638
66646
|
}
|
|
66639
66647
|
const { parent } = node;
|
|
66640
66648
|
switch (parent.kind) {
|
|
@@ -66705,17 +66713,30 @@ function createTypeChecker(host) {
|
|
|
66705
66713
|
}
|
|
66706
66714
|
return void 0;
|
|
66707
66715
|
}
|
|
66708
|
-
function
|
|
66716
|
+
function pushCachedContextualType(node) {
|
|
66717
|
+
pushContextualType(
|
|
66718
|
+
node,
|
|
66719
|
+
getContextualType(
|
|
66720
|
+
node,
|
|
66721
|
+
/*contextFlags*/
|
|
66722
|
+
void 0
|
|
66723
|
+
),
|
|
66724
|
+
/*isCache*/
|
|
66725
|
+
true
|
|
66726
|
+
);
|
|
66727
|
+
}
|
|
66728
|
+
function pushContextualType(node, type, isCache) {
|
|
66709
66729
|
contextualTypeNodes[contextualTypeCount] = node;
|
|
66710
66730
|
contextualTypes[contextualTypeCount] = type;
|
|
66731
|
+
contextualIsCache[contextualTypeCount] = isCache;
|
|
66711
66732
|
contextualTypeCount++;
|
|
66712
66733
|
}
|
|
66713
66734
|
function popContextualType() {
|
|
66714
66735
|
contextualTypeCount--;
|
|
66715
66736
|
}
|
|
66716
|
-
function findContextualNode(node) {
|
|
66737
|
+
function findContextualNode(node, includeCaches) {
|
|
66717
66738
|
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
66718
|
-
if (node === contextualTypeNodes[i]) {
|
|
66739
|
+
if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
|
|
66719
66740
|
return i;
|
|
66720
66741
|
}
|
|
66721
66742
|
}
|
|
@@ -66738,7 +66759,11 @@ function createTypeChecker(host) {
|
|
|
66738
66759
|
}
|
|
66739
66760
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
66740
66761
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
66741
|
-
const index = findContextualNode(
|
|
66762
|
+
const index = findContextualNode(
|
|
66763
|
+
node.parent,
|
|
66764
|
+
/*includeCaches*/
|
|
66765
|
+
!contextFlags
|
|
66766
|
+
);
|
|
66742
66767
|
if (index >= 0) {
|
|
66743
66768
|
return contextualTypes[index];
|
|
66744
66769
|
}
|
|
@@ -67009,11 +67034,7 @@ function createTypeChecker(host) {
|
|
|
67009
67034
|
const elementCount = elements.length;
|
|
67010
67035
|
const elementTypes = [];
|
|
67011
67036
|
const elementFlags = [];
|
|
67012
|
-
|
|
67013
|
-
node,
|
|
67014
|
-
/*contextFlags*/
|
|
67015
|
-
void 0
|
|
67016
|
-
));
|
|
67037
|
+
pushCachedContextualType(node);
|
|
67017
67038
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
67018
67039
|
const inConstContext = isConstContext(node);
|
|
67019
67040
|
const contextualType = getApparentTypeOfContextualType(
|
|
@@ -67176,11 +67197,7 @@ function createTypeChecker(host) {
|
|
|
67176
67197
|
let propertiesTable = createSymbolTable();
|
|
67177
67198
|
let propertiesArray = [];
|
|
67178
67199
|
let spread = emptyObjectType;
|
|
67179
|
-
|
|
67180
|
-
node,
|
|
67181
|
-
/*contextFlags*/
|
|
67182
|
-
void 0
|
|
67183
|
-
));
|
|
67200
|
+
pushCachedContextualType(node);
|
|
67184
67201
|
const contextualType = getApparentTypeOfContextualType(
|
|
67185
67202
|
node,
|
|
67186
67203
|
/*contextFlags*/
|
|
@@ -73191,14 +73208,19 @@ function createTypeChecker(host) {
|
|
|
73191
73208
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
73192
73209
|
}
|
|
73193
73210
|
function getContextNode(node) {
|
|
73194
|
-
if (node
|
|
73211
|
+
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
73195
73212
|
return node.parent.parent;
|
|
73196
73213
|
}
|
|
73197
73214
|
return node;
|
|
73198
73215
|
}
|
|
73199
73216
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
73200
73217
|
const contextNode = getContextNode(node);
|
|
73201
|
-
pushContextualType(
|
|
73218
|
+
pushContextualType(
|
|
73219
|
+
contextNode,
|
|
73220
|
+
contextualType,
|
|
73221
|
+
/*isCache*/
|
|
73222
|
+
false
|
|
73223
|
+
);
|
|
73202
73224
|
pushInferenceContext(contextNode, inferenceContext);
|
|
73203
73225
|
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
73204
73226
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
@@ -73539,7 +73561,12 @@ function createTypeChecker(host) {
|
|
|
73539
73561
|
if (links.contextFreeType) {
|
|
73540
73562
|
return links.contextFreeType;
|
|
73541
73563
|
}
|
|
73542
|
-
pushContextualType(
|
|
73564
|
+
pushContextualType(
|
|
73565
|
+
node,
|
|
73566
|
+
anyType,
|
|
73567
|
+
/*isCache*/
|
|
73568
|
+
false
|
|
73569
|
+
);
|
|
73543
73570
|
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
73544
73571
|
popContextualType();
|
|
73545
73572
|
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.20230211`;
|
|
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 = [];
|
|
@@ -55058,6 +55042,8 @@ function createTypeChecker(host) {
|
|
|
55058
55042
|
return !!target.baseTypesResolved;
|
|
55059
55043
|
case 8 /* WriteType */:
|
|
55060
55044
|
return !!getSymbolLinks(target).writeType;
|
|
55045
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
55046
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
55061
55047
|
}
|
|
55062
55048
|
return Debug.assertNever(propertyName);
|
|
55063
55049
|
}
|
|
@@ -62849,7 +62835,12 @@ function createTypeChecker(host) {
|
|
|
62849
62835
|
}
|
|
62850
62836
|
}
|
|
62851
62837
|
function checkExpressionForMutableLocationWithContextualType(next, sourcePropType) {
|
|
62852
|
-
pushContextualType(
|
|
62838
|
+
pushContextualType(
|
|
62839
|
+
next,
|
|
62840
|
+
sourcePropType,
|
|
62841
|
+
/*isCache*/
|
|
62842
|
+
false
|
|
62843
|
+
);
|
|
62853
62844
|
const result = checkExpressionForMutableLocation(next, 1 /* Contextual */);
|
|
62854
62845
|
popContextualType();
|
|
62855
62846
|
return result;
|
|
@@ -63157,7 +63148,12 @@ function createTypeChecker(host) {
|
|
|
63157
63148
|
if (isTupleLikeType(source)) {
|
|
63158
63149
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
63159
63150
|
}
|
|
63160
|
-
pushContextualType(
|
|
63151
|
+
pushContextualType(
|
|
63152
|
+
node,
|
|
63153
|
+
target,
|
|
63154
|
+
/*isCache*/
|
|
63155
|
+
false
|
|
63156
|
+
);
|
|
63161
63157
|
const tupleizedType = checkArrayLiteral(
|
|
63162
63158
|
node,
|
|
63163
63159
|
1 /* Contextual */,
|
|
@@ -69880,15 +69876,25 @@ function createTypeChecker(host) {
|
|
|
69880
69876
|
function isConstVariable(symbol) {
|
|
69881
69877
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
69882
69878
|
}
|
|
69883
|
-
function
|
|
69884
|
-
|
|
69885
|
-
|
|
69886
|
-
|
|
69887
|
-
|
|
69888
|
-
|
|
69889
|
-
|
|
69890
|
-
|
|
69879
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
69880
|
+
const links = getNodeLinks(declaration);
|
|
69881
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
69882
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
69883
|
+
reportCircularityError(declaration.symbol);
|
|
69884
|
+
return true;
|
|
69885
|
+
}
|
|
69886
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
69887
|
+
if (!popTypeResolution()) {
|
|
69888
|
+
reportCircularityError(declaration.symbol);
|
|
69889
|
+
return true;
|
|
69890
|
+
}
|
|
69891
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
69891
69892
|
}
|
|
69893
|
+
return links.parameterInitializerContainsUndefined;
|
|
69894
|
+
}
|
|
69895
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
69896
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
69897
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
69892
69898
|
}
|
|
69893
69899
|
function isConstraintPosition(type, node) {
|
|
69894
69900
|
const parent2 = node.parent;
|
|
@@ -71206,11 +71212,13 @@ function createTypeChecker(host) {
|
|
|
71206
71212
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
71207
71213
|
return void 0;
|
|
71208
71214
|
}
|
|
71209
|
-
const index = findContextualNode(
|
|
71215
|
+
const index = findContextualNode(
|
|
71216
|
+
node,
|
|
71217
|
+
/*includeCaches*/
|
|
71218
|
+
!contextFlags
|
|
71219
|
+
);
|
|
71210
71220
|
if (index >= 0) {
|
|
71211
|
-
|
|
71212
|
-
if (cached || !contextFlags)
|
|
71213
|
-
return cached;
|
|
71221
|
+
return contextualTypes[index];
|
|
71214
71222
|
}
|
|
71215
71223
|
const { parent: parent2 } = node;
|
|
71216
71224
|
switch (parent2.kind) {
|
|
@@ -71281,17 +71289,30 @@ function createTypeChecker(host) {
|
|
|
71281
71289
|
}
|
|
71282
71290
|
return void 0;
|
|
71283
71291
|
}
|
|
71284
|
-
function
|
|
71292
|
+
function pushCachedContextualType(node) {
|
|
71293
|
+
pushContextualType(
|
|
71294
|
+
node,
|
|
71295
|
+
getContextualType2(
|
|
71296
|
+
node,
|
|
71297
|
+
/*contextFlags*/
|
|
71298
|
+
void 0
|
|
71299
|
+
),
|
|
71300
|
+
/*isCache*/
|
|
71301
|
+
true
|
|
71302
|
+
);
|
|
71303
|
+
}
|
|
71304
|
+
function pushContextualType(node, type, isCache) {
|
|
71285
71305
|
contextualTypeNodes[contextualTypeCount] = node;
|
|
71286
71306
|
contextualTypes[contextualTypeCount] = type;
|
|
71307
|
+
contextualIsCache[contextualTypeCount] = isCache;
|
|
71287
71308
|
contextualTypeCount++;
|
|
71288
71309
|
}
|
|
71289
71310
|
function popContextualType() {
|
|
71290
71311
|
contextualTypeCount--;
|
|
71291
71312
|
}
|
|
71292
|
-
function findContextualNode(node) {
|
|
71313
|
+
function findContextualNode(node, includeCaches) {
|
|
71293
71314
|
for (let i = contextualTypeCount - 1; i >= 0; i--) {
|
|
71294
|
-
if (node === contextualTypeNodes[i]) {
|
|
71315
|
+
if (node === contextualTypeNodes[i] && (includeCaches || !contextualIsCache[i])) {
|
|
71295
71316
|
return i;
|
|
71296
71317
|
}
|
|
71297
71318
|
}
|
|
@@ -71314,7 +71335,11 @@ function createTypeChecker(host) {
|
|
|
71314
71335
|
}
|
|
71315
71336
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
71316
71337
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
71317
|
-
const index = findContextualNode(
|
|
71338
|
+
const index = findContextualNode(
|
|
71339
|
+
node.parent,
|
|
71340
|
+
/*includeCaches*/
|
|
71341
|
+
!contextFlags
|
|
71342
|
+
);
|
|
71318
71343
|
if (index >= 0) {
|
|
71319
71344
|
return contextualTypes[index];
|
|
71320
71345
|
}
|
|
@@ -71585,11 +71610,7 @@ function createTypeChecker(host) {
|
|
|
71585
71610
|
const elementCount = elements.length;
|
|
71586
71611
|
const elementTypes = [];
|
|
71587
71612
|
const elementFlags = [];
|
|
71588
|
-
|
|
71589
|
-
node,
|
|
71590
|
-
/*contextFlags*/
|
|
71591
|
-
void 0
|
|
71592
|
-
));
|
|
71613
|
+
pushCachedContextualType(node);
|
|
71593
71614
|
const inDestructuringPattern = isAssignmentTarget(node);
|
|
71594
71615
|
const inConstContext = isConstContext(node);
|
|
71595
71616
|
const contextualType = getApparentTypeOfContextualType(
|
|
@@ -71752,11 +71773,7 @@ function createTypeChecker(host) {
|
|
|
71752
71773
|
let propertiesTable = createSymbolTable();
|
|
71753
71774
|
let propertiesArray = [];
|
|
71754
71775
|
let spread = emptyObjectType;
|
|
71755
|
-
|
|
71756
|
-
node,
|
|
71757
|
-
/*contextFlags*/
|
|
71758
|
-
void 0
|
|
71759
|
-
));
|
|
71776
|
+
pushCachedContextualType(node);
|
|
71760
71777
|
const contextualType = getApparentTypeOfContextualType(
|
|
71761
71778
|
node,
|
|
71762
71779
|
/*contextFlags*/
|
|
@@ -77767,14 +77784,19 @@ function createTypeChecker(host) {
|
|
|
77767
77784
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
77768
77785
|
}
|
|
77769
77786
|
function getContextNode2(node) {
|
|
77770
|
-
if (node
|
|
77787
|
+
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
77771
77788
|
return node.parent.parent;
|
|
77772
77789
|
}
|
|
77773
77790
|
return node;
|
|
77774
77791
|
}
|
|
77775
77792
|
function checkExpressionWithContextualType(node, contextualType, inferenceContext, checkMode) {
|
|
77776
77793
|
const contextNode = getContextNode2(node);
|
|
77777
|
-
pushContextualType(
|
|
77794
|
+
pushContextualType(
|
|
77795
|
+
contextNode,
|
|
77796
|
+
contextualType,
|
|
77797
|
+
/*isCache*/
|
|
77798
|
+
false
|
|
77799
|
+
);
|
|
77778
77800
|
pushInferenceContext(contextNode, inferenceContext);
|
|
77779
77801
|
const type = checkExpression(node, checkMode | 1 /* Contextual */ | (inferenceContext ? 2 /* Inferential */ : 0));
|
|
77780
77802
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
@@ -78115,7 +78137,12 @@ function createTypeChecker(host) {
|
|
|
78115
78137
|
if (links.contextFreeType) {
|
|
78116
78138
|
return links.contextFreeType;
|
|
78117
78139
|
}
|
|
78118
|
-
pushContextualType(
|
|
78140
|
+
pushContextualType(
|
|
78141
|
+
node,
|
|
78142
|
+
anyType,
|
|
78143
|
+
/*isCache*/
|
|
78144
|
+
false
|
|
78145
|
+
);
|
|
78119
78146
|
const type = links.contextFreeType = checkExpression(node, 4 /* SkipContextSensitive */);
|
|
78120
78147
|
popContextualType();
|
|
78121
78148
|
return type;
|
|
@@ -141248,6 +141275,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141248
141275
|
sourceFile,
|
|
141249
141276
|
symbol,
|
|
141250
141277
|
symbolName2,
|
|
141278
|
+
moduleSymbol,
|
|
141251
141279
|
/*isJsxTagName*/
|
|
141252
141280
|
false,
|
|
141253
141281
|
program,
|
|
@@ -141259,7 +141287,6 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141259
141287
|
const fix = getImportFixForSymbol(
|
|
141260
141288
|
sourceFile,
|
|
141261
141289
|
Debug.checkDefined(exportInfo),
|
|
141262
|
-
moduleSymbol,
|
|
141263
141290
|
program,
|
|
141264
141291
|
/*position*/
|
|
141265
141292
|
void 0,
|
|
@@ -141437,13 +141464,19 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
|
|
|
141437
141464
|
return result && { ...result, computedWithoutCacheCount };
|
|
141438
141465
|
}
|
|
141439
141466
|
}
|
|
141440
|
-
function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
141467
|
+
function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
141441
141468
|
const compilerOptions = program.getCompilerOptions();
|
|
141442
|
-
|
|
141443
|
-
|
|
141469
|
+
let exportInfos;
|
|
141470
|
+
if (exportMapKey) {
|
|
141471
|
+
exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
|
|
141472
|
+
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified exportMapKey");
|
|
141473
|
+
} else {
|
|
141474
|
+
exportInfos = pathIsBareSpecifier(stripQuotes(moduleSymbol.name)) ? [getSingleExportInfoForSymbol(targetSymbol, symbolName2, moduleSymbol, program, host)] : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName2, moduleSymbol, isJsxTagName, program, host, preferences, cancellationToken);
|
|
141475
|
+
Debug.assertIsDefined(exportInfos, "Some exportInfo should match the specified symbol / moduleSymbol");
|
|
141476
|
+
}
|
|
141444
141477
|
const useRequire = shouldUseRequire(sourceFile, program);
|
|
141445
141478
|
const isValidTypeOnlyUseSite = isValidTypeOnlyAliasUseSite(getTokenAtPosition(sourceFile, position));
|
|
141446
|
-
const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos,
|
|
141479
|
+
const fix = Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences));
|
|
141447
141480
|
return {
|
|
141448
141481
|
moduleSpecifier: fix.moduleSpecifier,
|
|
141449
141482
|
codeAction: codeFixActionToCodeAction(codeActionForFix(
|
|
@@ -141465,23 +141498,22 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
|
|
|
141465
141498
|
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
|
|
141466
141499
|
return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
|
|
141467
141500
|
}
|
|
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");
|
|
141501
|
+
function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
141470
141502
|
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
141471
141503
|
return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
|
|
141472
141504
|
}
|
|
141473
141505
|
function codeFixActionToCodeAction({ description: description2, changes, commands }) {
|
|
141474
141506
|
return { description: description2, changes, commands };
|
|
141475
141507
|
}
|
|
141476
|
-
function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, preferCapitalized, program, host, preferences, cancellationToken) {
|
|
141508
|
+
function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) {
|
|
141477
141509
|
const getChecker = createGetChecker(program, host);
|
|
141478
141510
|
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) {
|
|
141511
|
+
if (skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol && info.some((i) => i.moduleSymbol === moduleSymbol || i.symbol.parent === moduleSymbol)) {
|
|
141480
141512
|
return info;
|
|
141481
141513
|
}
|
|
141482
141514
|
});
|
|
141483
141515
|
}
|
|
141484
|
-
function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
|
|
141516
|
+
function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
|
|
141485
141517
|
var _a2, _b;
|
|
141486
141518
|
const compilerOptions = program.getCompilerOptions();
|
|
141487
141519
|
const mainProgramInfo = getInfoWithChecker(
|
|
@@ -141503,7 +141535,7 @@ function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) {
|
|
|
141503
141535
|
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
|
|
141504
141536
|
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
|
|
141505
141537
|
}
|
|
141506
|
-
const named = checker.tryGetMemberInModuleExportsAndProperties(
|
|
141538
|
+
const named = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
|
|
141507
141539
|
if (named && skipAlias(named, checker) === symbol) {
|
|
141508
141540
|
return { symbol: named, moduleSymbol, moduleFileName: void 0, exportKind: 0 /* Named */, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
|
|
141509
141541
|
}
|
|
@@ -149162,6 +149194,7 @@ function originToCompletionEntryData(origin) {
|
|
|
149162
149194
|
if (originIsResolvedExport(origin)) {
|
|
149163
149195
|
const resolvedData = {
|
|
149164
149196
|
exportName: origin.exportName,
|
|
149197
|
+
exportMapKey: origin.exportMapKey,
|
|
149165
149198
|
moduleSpecifier: origin.moduleSpecifier,
|
|
149166
149199
|
ambientModuleName,
|
|
149167
149200
|
fileName: origin.fileName,
|
|
@@ -149185,6 +149218,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
149185
149218
|
const resolvedOrigin = {
|
|
149186
149219
|
kind: 32 /* ResolvedExport */,
|
|
149187
149220
|
exportName: data.exportName,
|
|
149221
|
+
exportMapKey: data.exportMapKey,
|
|
149188
149222
|
moduleSpecifier: data.moduleSpecifier,
|
|
149189
149223
|
symbolName: completionName,
|
|
149190
149224
|
fileName: data.fileName,
|
|
@@ -149563,6 +149597,7 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
149563
149597
|
const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction(
|
|
149564
149598
|
targetSymbol,
|
|
149565
149599
|
moduleSymbol,
|
|
149600
|
+
data == null ? void 0 : data.exportMapKey,
|
|
149566
149601
|
sourceFile,
|
|
149567
149602
|
name,
|
|
149568
149603
|
isJsxOpeningTagName,
|
|
@@ -150261,16 +150296,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150261
150296
|
if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) {
|
|
150262
150297
|
return;
|
|
150263
150298
|
}
|
|
150264
|
-
|
|
150265
|
-
if (!
|
|
150299
|
+
info = filter(info, isImportableExportInfo);
|
|
150300
|
+
if (!info.length) {
|
|
150266
150301
|
return;
|
|
150267
150302
|
}
|
|
150268
150303
|
const result = context.tryResolve(info, isFromAmbientModule) || {};
|
|
150269
150304
|
if (result === "failed")
|
|
150270
150305
|
return;
|
|
150271
|
-
let exportInfo2 =
|
|
150306
|
+
let exportInfo2 = info[0], moduleSpecifier;
|
|
150272
150307
|
if (result !== "skipped") {
|
|
150273
|
-
({ exportInfo: exportInfo2 =
|
|
150308
|
+
({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result);
|
|
150274
150309
|
}
|
|
150275
150310
|
const isDefaultExport = exportInfo2.exportKind === 1 /* Default */;
|
|
150276
150311
|
const symbol = isDefaultExport && getLocalSymbolForExportDefault(exportInfo2.symbol) || exportInfo2.symbol;
|