@typescript-deploys/pr-build 5.5.0-pr-57421-17 → 5.5.0-pr-57207-16
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 +358 -557
- package/lib/tsserver.js +449 -627
- package/lib/typescript.d.ts +20 -9
- package/lib/typescript.js +448 -626
- package/lib/typingsInstaller.js +100 -294
- package/package.json +18 -19
package/lib/tsc.js
CHANGED
|
@@ -15,39 +15,10 @@ and limitations under the License.
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
"use strict";
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
21
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
22
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
23
|
-
if (decorator = decorators[i])
|
|
24
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
25
|
-
if (kind && result)
|
|
26
|
-
__defProp(target, key, result);
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
var __accessCheck = (obj, member, msg) => {
|
|
30
|
-
if (!member.has(obj))
|
|
31
|
-
throw TypeError("Cannot " + msg);
|
|
32
|
-
};
|
|
33
|
-
var __privateGet = (obj, member, getter) => {
|
|
34
|
-
__accessCheck(obj, member, "read from private field");
|
|
35
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
36
|
-
};
|
|
37
|
-
var __privateAdd = (obj, member, value) => {
|
|
38
|
-
if (member.has(obj))
|
|
39
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
40
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
41
|
-
};
|
|
42
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
43
|
-
__accessCheck(obj, member, "write to private field");
|
|
44
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
45
|
-
return value;
|
|
46
|
-
};
|
|
47
18
|
|
|
48
19
|
// src/compiler/corePublic.ts
|
|
49
20
|
var versionMajorMinor = "5.5";
|
|
50
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240307`;
|
|
51
22
|
|
|
52
23
|
// src/compiler/core.ts
|
|
53
24
|
var emptyArray = [];
|
|
@@ -3369,12 +3340,13 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
|
|
|
3369
3340
|
SyntaxKind4[SyntaxKind4["JSDocPropertyTag"] = 348] = "JSDocPropertyTag";
|
|
3370
3341
|
SyntaxKind4[SyntaxKind4["JSDocThrowsTag"] = 349] = "JSDocThrowsTag";
|
|
3371
3342
|
SyntaxKind4[SyntaxKind4["JSDocSatisfiesTag"] = 350] = "JSDocSatisfiesTag";
|
|
3372
|
-
SyntaxKind4[SyntaxKind4["
|
|
3373
|
-
SyntaxKind4[SyntaxKind4["
|
|
3374
|
-
SyntaxKind4[SyntaxKind4["
|
|
3375
|
-
SyntaxKind4[SyntaxKind4["
|
|
3376
|
-
SyntaxKind4[SyntaxKind4["
|
|
3377
|
-
SyntaxKind4[SyntaxKind4["
|
|
3343
|
+
SyntaxKind4[SyntaxKind4["JSDocImportTag"] = 351] = "JSDocImportTag";
|
|
3344
|
+
SyntaxKind4[SyntaxKind4["SyntaxList"] = 352] = "SyntaxList";
|
|
3345
|
+
SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 353] = "NotEmittedStatement";
|
|
3346
|
+
SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 354] = "PartiallyEmittedExpression";
|
|
3347
|
+
SyntaxKind4[SyntaxKind4["CommaListExpression"] = 355] = "CommaListExpression";
|
|
3348
|
+
SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 356] = "SyntheticReferenceExpression";
|
|
3349
|
+
SyntaxKind4[SyntaxKind4["Count"] = 357] = "Count";
|
|
3378
3350
|
SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
|
|
3379
3351
|
SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
|
|
3380
3352
|
SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
|
|
@@ -3403,9 +3375,9 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
|
|
|
3403
3375
|
SyntaxKind4[SyntaxKind4["LastStatement"] = 259 /* DebuggerStatement */] = "LastStatement";
|
|
3404
3376
|
SyntaxKind4[SyntaxKind4["FirstNode"] = 166 /* QualifiedName */] = "FirstNode";
|
|
3405
3377
|
SyntaxKind4[SyntaxKind4["FirstJSDocNode"] = 309 /* JSDocTypeExpression */] = "FirstJSDocNode";
|
|
3406
|
-
SyntaxKind4[SyntaxKind4["LastJSDocNode"] =
|
|
3378
|
+
SyntaxKind4[SyntaxKind4["LastJSDocNode"] = 351 /* JSDocImportTag */] = "LastJSDocNode";
|
|
3407
3379
|
SyntaxKind4[SyntaxKind4["FirstJSDocTagNode"] = 327 /* JSDocTag */] = "FirstJSDocTagNode";
|
|
3408
|
-
SyntaxKind4[SyntaxKind4["LastJSDocTagNode"] =
|
|
3380
|
+
SyntaxKind4[SyntaxKind4["LastJSDocTagNode"] = 351 /* JSDocImportTag */] = "LastJSDocTagNode";
|
|
3409
3381
|
SyntaxKind4[SyntaxKind4["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword";
|
|
3410
3382
|
SyntaxKind4[SyntaxKind4["LastContextualKeyword"] = 165 /* OfKeyword */] = "LastContextualKeyword";
|
|
3411
3383
|
return SyntaxKind4;
|
|
@@ -4863,7 +4835,7 @@ var sys = (() => {
|
|
|
4863
4835
|
}
|
|
4864
4836
|
let activeSession;
|
|
4865
4837
|
let profilePath = "./profile.cpuprofile";
|
|
4866
|
-
const
|
|
4838
|
+
const Buffer = require("buffer").Buffer;
|
|
4867
4839
|
const isMacOs = process.platform === "darwin";
|
|
4868
4840
|
const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
|
|
4869
4841
|
const platform = _os.platform();
|
|
@@ -5073,7 +5045,7 @@ var sys = (() => {
|
|
|
5073
5045
|
}
|
|
5074
5046
|
}
|
|
5075
5047
|
function bufferFrom(input, encoding) {
|
|
5076
|
-
return
|
|
5048
|
+
return Buffer.from && Buffer.from !== Int8Array.from ? Buffer.from(input, encoding) : new Buffer(input, encoding);
|
|
5077
5049
|
}
|
|
5078
5050
|
function isFileSystemCaseSensitive() {
|
|
5079
5051
|
if (platform === "win32" || platform === "win64") {
|
|
@@ -7583,6 +7555,7 @@ var Diagnostics = {
|
|
|
7583
7555
|
Update_import_from_0: diag(90058, 3 /* Message */, "Update_import_from_0_90058", 'Update import from "{0}"'),
|
|
7584
7556
|
Export_0_from_module_1: diag(90059, 3 /* Message */, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
|
|
7585
7557
|
Export_all_referenced_locals: diag(90060, 3 /* Message */, "Export_all_referenced_locals_90060", "Export all referenced locals"),
|
|
7558
|
+
Update_modifiers_of_0: diag(90061, 3 /* Message */, "Update_modifiers_of_0_90061", "Update modifiers of '{0}'"),
|
|
7586
7559
|
Convert_function_to_an_ES2015_class: diag(95001, 3 /* Message */, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
7587
7560
|
Convert_0_to_1_in_0: diag(95003, 3 /* Message */, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
7588
7561
|
Extract_to_0_in_1: diag(95004, 3 /* Message */, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -8464,7 +8437,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8464
8437
|
var tokenValue;
|
|
8465
8438
|
var tokenFlags;
|
|
8466
8439
|
var commentDirectives;
|
|
8467
|
-
var
|
|
8440
|
+
var skipJsDocLeadingAsterisks = 0;
|
|
8468
8441
|
var scriptKind = 0 /* Unknown */;
|
|
8469
8442
|
var jsDocParsingMode = 0 /* ParseAll */;
|
|
8470
8443
|
setText(text, start, length2);
|
|
@@ -8515,7 +8488,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8515
8488
|
setOnError,
|
|
8516
8489
|
resetTokenState,
|
|
8517
8490
|
setTextPos: resetTokenState,
|
|
8518
|
-
|
|
8491
|
+
setSkipJsDocLeadingAsterisks,
|
|
8519
8492
|
tryScan,
|
|
8520
8493
|
lookAhead,
|
|
8521
8494
|
scanRange
|
|
@@ -9231,7 +9204,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9231
9204
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
9232
9205
|
}
|
|
9233
9206
|
pos++;
|
|
9234
|
-
if (
|
|
9207
|
+
if (skipJsDocLeadingAsterisks && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) {
|
|
9235
9208
|
asteriskSeen = true;
|
|
9236
9209
|
continue;
|
|
9237
9210
|
}
|
|
@@ -10009,8 +9982,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10009
9982
|
tokenValue = void 0;
|
|
10010
9983
|
tokenFlags = 0 /* None */;
|
|
10011
9984
|
}
|
|
10012
|
-
function
|
|
10013
|
-
|
|
9985
|
+
function setSkipJsDocLeadingAsterisks(skip) {
|
|
9986
|
+
skipJsDocLeadingAsterisks += skip ? 1 : -1;
|
|
10014
9987
|
}
|
|
10015
9988
|
}
|
|
10016
9989
|
function codePointAt(s, i) {
|
|
@@ -11063,8 +11036,8 @@ function isExpressionKind(kind) {
|
|
|
11063
11036
|
case 230 /* SpreadElement */:
|
|
11064
11037
|
case 234 /* AsExpression */:
|
|
11065
11038
|
case 232 /* OmittedExpression */:
|
|
11066
|
-
case
|
|
11067
|
-
case
|
|
11039
|
+
case 355 /* CommaListExpression */:
|
|
11040
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
11068
11041
|
case 238 /* SatisfiesExpression */:
|
|
11069
11042
|
return true;
|
|
11070
11043
|
default:
|
|
@@ -11235,7 +11208,7 @@ function isDeclarationStatementKind(kind) {
|
|
|
11235
11208
|
return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */;
|
|
11236
11209
|
}
|
|
11237
11210
|
function isStatementKindButNotDeclarationKind(kind) {
|
|
11238
|
-
return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind ===
|
|
11211
|
+
return kind === 252 /* BreakStatement */ || kind === 251 /* ContinueStatement */ || kind === 259 /* DebuggerStatement */ || kind === 246 /* DoStatement */ || kind === 244 /* ExpressionStatement */ || kind === 242 /* EmptyStatement */ || kind === 249 /* ForInStatement */ || kind === 250 /* ForOfStatement */ || kind === 248 /* ForStatement */ || kind === 245 /* IfStatement */ || kind === 256 /* LabeledStatement */ || kind === 253 /* ReturnStatement */ || kind === 255 /* SwitchStatement */ || kind === 257 /* ThrowStatement */ || kind === 258 /* TryStatement */ || kind === 243 /* VariableStatement */ || kind === 247 /* WhileStatement */ || kind === 254 /* WithStatement */ || kind === 353 /* NotEmittedStatement */;
|
|
11239
11212
|
}
|
|
11240
11213
|
function isDeclaration(node) {
|
|
11241
11214
|
if (node.kind === 168 /* TypeParameter */) {
|
|
@@ -11296,10 +11269,10 @@ function isCaseOrDefaultClause(node) {
|
|
|
11296
11269
|
return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
|
|
11297
11270
|
}
|
|
11298
11271
|
function isJSDocNode(node) {
|
|
11299
|
-
return node.kind >= 309 /* FirstJSDocNode */ && node.kind <=
|
|
11272
|
+
return node.kind >= 309 /* FirstJSDocNode */ && node.kind <= 351 /* LastJSDocNode */;
|
|
11300
11273
|
}
|
|
11301
11274
|
function isJSDocTag(node) {
|
|
11302
|
-
return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <=
|
|
11275
|
+
return node.kind >= 327 /* FirstJSDocTagNode */ && node.kind <= 351 /* LastJSDocTagNode */;
|
|
11303
11276
|
}
|
|
11304
11277
|
function isSetAccessor(node) {
|
|
11305
11278
|
return node.kind === 178 /* SetAccessor */;
|
|
@@ -11740,7 +11713,7 @@ function getTokenPosOfNode(node, sourceFile, includeJsDoc) {
|
|
|
11740
11713
|
if (includeJsDoc && hasJSDocNodes(node)) {
|
|
11741
11714
|
return getTokenPosOfNode(node.jsDoc[0], sourceFile);
|
|
11742
11715
|
}
|
|
11743
|
-
if (node.kind ===
|
|
11716
|
+
if (node.kind === 352 /* SyntaxList */ && node._children.length > 0) {
|
|
11744
11717
|
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
|
|
11745
11718
|
}
|
|
11746
11719
|
return skipTrivia(
|
|
@@ -13691,6 +13664,7 @@ function tryGetModuleSpecifierFromDeclaration(node) {
|
|
|
13691
13664
|
))) == null ? void 0 : _a.arguments[0];
|
|
13692
13665
|
case 272 /* ImportDeclaration */:
|
|
13693
13666
|
case 278 /* ExportDeclaration */:
|
|
13667
|
+
case 351 /* JSDocImportTag */:
|
|
13694
13668
|
return tryCast(node.moduleSpecifier, isStringLiteralLike);
|
|
13695
13669
|
case 271 /* ImportEqualsDeclaration */:
|
|
13696
13670
|
return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike);
|
|
@@ -13712,6 +13686,7 @@ function getExternalModuleName(node) {
|
|
|
13712
13686
|
switch (node.kind) {
|
|
13713
13687
|
case 272 /* ImportDeclaration */:
|
|
13714
13688
|
case 278 /* ExportDeclaration */:
|
|
13689
|
+
case 351 /* JSDocImportTag */:
|
|
13715
13690
|
return node.moduleSpecifier;
|
|
13716
13691
|
case 271 /* ImportEqualsDeclaration */:
|
|
13717
13692
|
return node.moduleReference.kind === 283 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0;
|
|
@@ -13738,7 +13713,7 @@ function getNamespaceDeclarationNode(node) {
|
|
|
13738
13713
|
}
|
|
13739
13714
|
}
|
|
13740
13715
|
function isDefaultImport(node) {
|
|
13741
|
-
return node.kind === 272 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
|
|
13716
|
+
return (node.kind === 272 /* ImportDeclaration */ || node.kind === 351 /* JSDocImportTag */) && !!node.importClause && !!node.importClause.name;
|
|
13742
13717
|
}
|
|
13743
13718
|
function hasQuestionToken(node) {
|
|
13744
13719
|
if (node) {
|
|
@@ -14511,7 +14486,7 @@ function getOperator(expression) {
|
|
|
14511
14486
|
}
|
|
14512
14487
|
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
|
|
14513
14488
|
switch (nodeKind) {
|
|
14514
|
-
case
|
|
14489
|
+
case 355 /* CommaListExpression */:
|
|
14515
14490
|
return 0 /* Comma */;
|
|
14516
14491
|
case 230 /* SpreadElement */:
|
|
14517
14492
|
return 1 /* Spread */;
|
|
@@ -14651,34 +14626,15 @@ function getSemanticJsxChildren(children) {
|
|
|
14651
14626
|
}
|
|
14652
14627
|
function createDiagnosticCollection() {
|
|
14653
14628
|
let nonFileDiagnostics = [];
|
|
14654
|
-
|
|
14655
|
-
|
|
14629
|
+
const filesWithDiagnostics = [];
|
|
14630
|
+
const fileDiagnostics = /* @__PURE__ */ new Map();
|
|
14656
14631
|
let hasReadNonFileDiagnostics = false;
|
|
14657
14632
|
return {
|
|
14658
14633
|
add,
|
|
14659
14634
|
lookup,
|
|
14660
14635
|
getGlobalDiagnostics,
|
|
14661
|
-
getDiagnostics
|
|
14662
|
-
checkpoint,
|
|
14663
|
-
revert
|
|
14636
|
+
getDiagnostics
|
|
14664
14637
|
};
|
|
14665
|
-
function checkpoint() {
|
|
14666
|
-
const c = {
|
|
14667
|
-
nonFileDiagnostics: nonFileDiagnostics.slice(),
|
|
14668
|
-
filesWithDiagnostics: filesWithDiagnostics.slice(),
|
|
14669
|
-
fileDiagnostics: new Map(map(arrayFrom(fileDiagnostics.entries()), ([k, v]) => [k, v.slice()])),
|
|
14670
|
-
hasReadNonFileDiagnostics
|
|
14671
|
-
};
|
|
14672
|
-
return c;
|
|
14673
|
-
}
|
|
14674
|
-
function revert(checkpoint2) {
|
|
14675
|
-
({
|
|
14676
|
-
nonFileDiagnostics,
|
|
14677
|
-
filesWithDiagnostics,
|
|
14678
|
-
fileDiagnostics,
|
|
14679
|
-
hasReadNonFileDiagnostics
|
|
14680
|
-
} = checkpoint2);
|
|
14681
|
-
}
|
|
14682
14638
|
function lookup(diagnostic) {
|
|
14683
14639
|
let diagnostics;
|
|
14684
14640
|
if (diagnostic.file) {
|
|
@@ -16079,7 +16035,7 @@ function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
|
16079
16035
|
case 212 /* ElementAccessExpression */:
|
|
16080
16036
|
case 211 /* PropertyAccessExpression */:
|
|
16081
16037
|
case 235 /* NonNullExpression */:
|
|
16082
|
-
case
|
|
16038
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
16083
16039
|
case 238 /* SatisfiesExpression */:
|
|
16084
16040
|
node = node.expression;
|
|
16085
16041
|
continue;
|
|
@@ -16284,17 +16240,6 @@ function createCompilerDiagnosticFromMessageChain(chain, relatedInformation) {
|
|
|
16284
16240
|
relatedInformation
|
|
16285
16241
|
};
|
|
16286
16242
|
}
|
|
16287
|
-
function prefixDiagnosticWithMessageChain(base, chain) {
|
|
16288
|
-
if (!chain)
|
|
16289
|
-
return base;
|
|
16290
|
-
concatenateDiagnosticMessageChains(chain, createDiagnosticMessageChainFromDiagnostic(base));
|
|
16291
|
-
return {
|
|
16292
|
-
...base,
|
|
16293
|
-
code: chain.code,
|
|
16294
|
-
category: chain.category,
|
|
16295
|
-
messageText: chain.next ? chain : chain.messageText
|
|
16296
|
-
};
|
|
16297
|
-
}
|
|
16298
16243
|
function chainDiagnosticMessages(details, message, ...args) {
|
|
16299
16244
|
let text = getLocaleSpecificMessage(message);
|
|
16300
16245
|
if (some(args)) {
|
|
@@ -17477,7 +17422,7 @@ function getContainingNodeArray(node) {
|
|
|
17477
17422
|
return parent.types;
|
|
17478
17423
|
case 189 /* TupleType */:
|
|
17479
17424
|
case 209 /* ArrayLiteralExpression */:
|
|
17480
|
-
case
|
|
17425
|
+
case 355 /* CommaListExpression */:
|
|
17481
17426
|
case 275 /* NamedImports */:
|
|
17482
17427
|
case 279 /* NamedExports */:
|
|
17483
17428
|
return parent.elements;
|
|
@@ -18662,6 +18607,8 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18662
18607
|
updateJSDocImplementsTag,
|
|
18663
18608
|
createJSDocSeeTag,
|
|
18664
18609
|
updateJSDocSeeTag,
|
|
18610
|
+
createJSDocImportTag,
|
|
18611
|
+
updateJSDocImportTag,
|
|
18665
18612
|
createJSDocNameReference,
|
|
18666
18613
|
updateJSDocNameReference,
|
|
18667
18614
|
createJSDocMemberName,
|
|
@@ -21434,6 +21381,17 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21434
21381
|
function updateJSDocEnumTag(node, tagName = getDefaultTagName(node), typeExpression, comment) {
|
|
21435
21382
|
return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node;
|
|
21436
21383
|
}
|
|
21384
|
+
function createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment) {
|
|
21385
|
+
const node = createBaseJSDocTag(351 /* JSDocImportTag */, tagName ?? createIdentifier("import"), comment);
|
|
21386
|
+
node.importClause = importClause;
|
|
21387
|
+
node.moduleSpecifier = moduleSpecifier;
|
|
21388
|
+
node.attributes = attributes;
|
|
21389
|
+
node.comment = comment;
|
|
21390
|
+
return node;
|
|
21391
|
+
}
|
|
21392
|
+
function updateJSDocImportTag(node, tagName, importClause, moduleSpecifier, attributes, comment) {
|
|
21393
|
+
return node.tagName !== tagName || node.comment !== comment || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comment), node) : node;
|
|
21394
|
+
}
|
|
21437
21395
|
function createJSDocText(text) {
|
|
21438
21396
|
const node = createBaseNode(321 /* JSDocText */);
|
|
21439
21397
|
node.text = text;
|
|
@@ -21831,18 +21789,18 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21831
21789
|
return node;
|
|
21832
21790
|
}
|
|
21833
21791
|
function createSyntaxList(children) {
|
|
21834
|
-
const node = createBaseNode(
|
|
21792
|
+
const node = createBaseNode(352 /* SyntaxList */);
|
|
21835
21793
|
node._children = children;
|
|
21836
21794
|
return node;
|
|
21837
21795
|
}
|
|
21838
21796
|
function createNotEmittedStatement(original) {
|
|
21839
|
-
const node = createBaseNode(
|
|
21797
|
+
const node = createBaseNode(353 /* NotEmittedStatement */);
|
|
21840
21798
|
node.original = original;
|
|
21841
21799
|
setTextRange(node, original);
|
|
21842
21800
|
return node;
|
|
21843
21801
|
}
|
|
21844
21802
|
function createPartiallyEmittedExpression(expression, original) {
|
|
21845
|
-
const node = createBaseNode(
|
|
21803
|
+
const node = createBaseNode(354 /* PartiallyEmittedExpression */);
|
|
21846
21804
|
node.expression = expression;
|
|
21847
21805
|
node.original = original;
|
|
21848
21806
|
node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */;
|
|
@@ -21864,7 +21822,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21864
21822
|
return node;
|
|
21865
21823
|
}
|
|
21866
21824
|
function createCommaListExpression(elements) {
|
|
21867
|
-
const node = createBaseNode(
|
|
21825
|
+
const node = createBaseNode(355 /* CommaListExpression */);
|
|
21868
21826
|
node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements));
|
|
21869
21827
|
node.transformFlags |= propagateChildrenFlags(node.elements);
|
|
21870
21828
|
return node;
|
|
@@ -21873,7 +21831,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
21873
21831
|
return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
|
|
21874
21832
|
}
|
|
21875
21833
|
function createSyntheticReferenceExpression(expression, thisArg) {
|
|
21876
|
-
const node = createBaseNode(
|
|
21834
|
+
const node = createBaseNode(356 /* SyntheticReferenceExpression */);
|
|
21877
21835
|
node.expression = expression;
|
|
21878
21836
|
node.thisArg = thisArg;
|
|
21879
21837
|
node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
|
|
@@ -22119,7 +22077,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22119
22077
|
return updateSatisfiesExpression(outerExpression, expression, outerExpression.type);
|
|
22120
22078
|
case 235 /* NonNullExpression */:
|
|
22121
22079
|
return updateNonNullExpression(outerExpression, expression);
|
|
22122
|
-
case
|
|
22080
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
22123
22081
|
return updatePartiallyEmittedExpression(outerExpression, expression);
|
|
22124
22082
|
}
|
|
22125
22083
|
}
|
|
@@ -22529,6 +22487,8 @@ function getDefaultTagNameForKind(kind) {
|
|
|
22529
22487
|
return "augments";
|
|
22530
22488
|
case 329 /* JSDocImplementsTag */:
|
|
22531
22489
|
return "implements";
|
|
22490
|
+
case 351 /* JSDocImportTag */:
|
|
22491
|
+
return "import";
|
|
22532
22492
|
default:
|
|
22533
22493
|
return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`);
|
|
22534
22494
|
}
|
|
@@ -22669,7 +22629,7 @@ function getTransformFlagsSubtreeExclusions(kind) {
|
|
|
22669
22629
|
case 216 /* TypeAssertionExpression */:
|
|
22670
22630
|
case 238 /* SatisfiesExpression */:
|
|
22671
22631
|
case 234 /* AsExpression */:
|
|
22672
|
-
case
|
|
22632
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
22673
22633
|
case 217 /* ParenthesizedExpression */:
|
|
22674
22634
|
case 108 /* SuperKeyword */:
|
|
22675
22635
|
return -2147483648 /* OuterExpressionExcludes */;
|
|
@@ -24307,10 +24267,10 @@ function isMetaProperty(node) {
|
|
|
24307
24267
|
return node.kind === 236 /* MetaProperty */;
|
|
24308
24268
|
}
|
|
24309
24269
|
function isPartiallyEmittedExpression(node) {
|
|
24310
|
-
return node.kind ===
|
|
24270
|
+
return node.kind === 354 /* PartiallyEmittedExpression */;
|
|
24311
24271
|
}
|
|
24312
24272
|
function isCommaListExpression(node) {
|
|
24313
|
-
return node.kind ===
|
|
24273
|
+
return node.kind === 355 /* CommaListExpression */;
|
|
24314
24274
|
}
|
|
24315
24275
|
function isTemplateSpan(node) {
|
|
24316
24276
|
return node.kind === 239 /* TemplateSpan */;
|
|
@@ -24433,10 +24393,10 @@ function isExportSpecifier(node) {
|
|
|
24433
24393
|
return node.kind === 281 /* ExportSpecifier */;
|
|
24434
24394
|
}
|
|
24435
24395
|
function isNotEmittedStatement(node) {
|
|
24436
|
-
return node.kind ===
|
|
24396
|
+
return node.kind === 353 /* NotEmittedStatement */;
|
|
24437
24397
|
}
|
|
24438
24398
|
function isSyntheticReference(node) {
|
|
24439
|
-
return node.kind ===
|
|
24399
|
+
return node.kind === 356 /* SyntheticReferenceExpression */;
|
|
24440
24400
|
}
|
|
24441
24401
|
function isExternalModuleReference(node) {
|
|
24442
24402
|
return node.kind === 283 /* ExternalModuleReference */;
|
|
@@ -24603,6 +24563,9 @@ function isJSDocImplementsTag(node) {
|
|
|
24603
24563
|
function isJSDocSatisfiesTag(node) {
|
|
24604
24564
|
return node.kind === 350 /* JSDocSatisfiesTag */;
|
|
24605
24565
|
}
|
|
24566
|
+
function isJSDocImportTag(node) {
|
|
24567
|
+
return node.kind === 351 /* JSDocImportTag */;
|
|
24568
|
+
}
|
|
24606
24569
|
|
|
24607
24570
|
// src/compiler/factory/utilities.ts
|
|
24608
24571
|
function createEmptyExports(factory2) {
|
|
@@ -24985,7 +24948,7 @@ function isOuterExpression(node, kinds = 15 /* All */) {
|
|
|
24985
24948
|
return (kinds & 2 /* TypeAssertions */) !== 0;
|
|
24986
24949
|
case 235 /* NonNullExpression */:
|
|
24987
24950
|
return (kinds & 4 /* NonNullAssertions */) !== 0;
|
|
24988
|
-
case
|
|
24951
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
24989
24952
|
return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0;
|
|
24990
24953
|
}
|
|
24991
24954
|
return false;
|
|
@@ -26061,7 +26024,7 @@ var forEachChildTable = {
|
|
|
26061
26024
|
[282 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) {
|
|
26062
26025
|
return visitNodes(cbNode, cbNodes, node.modifiers);
|
|
26063
26026
|
},
|
|
26064
|
-
[
|
|
26027
|
+
[355 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) {
|
|
26065
26028
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
26066
26029
|
},
|
|
26067
26030
|
[284 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) {
|
|
@@ -26156,7 +26119,8 @@ var forEachChildTable = {
|
|
|
26156
26119
|
[336 /* JSDocReadonlyTag */]: forEachChildInJSDocTag,
|
|
26157
26120
|
[331 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag,
|
|
26158
26121
|
[337 /* JSDocOverrideTag */]: forEachChildInJSDocTag,
|
|
26159
|
-
[
|
|
26122
|
+
[351 /* JSDocImportTag */]: forEachChildInJSDocImportTag,
|
|
26123
|
+
[354 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression
|
|
26160
26124
|
};
|
|
26161
26125
|
function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) {
|
|
26162
26126
|
return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type);
|
|
@@ -26207,6 +26171,9 @@ function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) {
|
|
|
26207
26171
|
function forEachChildInJSDocTag(node, cbNode, cbNodes) {
|
|
26208
26172
|
return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
|
|
26209
26173
|
}
|
|
26174
|
+
function forEachChildInJSDocImportTag(node, cbNode, cbNodes) {
|
|
26175
|
+
return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment));
|
|
26176
|
+
}
|
|
26210
26177
|
function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) {
|
|
26211
26178
|
return visitNode2(cbNode, node.expression);
|
|
26212
26179
|
}
|
|
@@ -28199,7 +28166,7 @@ var Parser;
|
|
|
28199
28166
|
);
|
|
28200
28167
|
}
|
|
28201
28168
|
function parseJSDocType() {
|
|
28202
|
-
scanner.
|
|
28169
|
+
scanner.setSkipJsDocLeadingAsterisks(true);
|
|
28203
28170
|
const pos = getNodePos();
|
|
28204
28171
|
if (parseOptional(144 /* ModuleKeyword */)) {
|
|
28205
28172
|
const moduleTag = factory2.createJSDocNamepathType(
|
|
@@ -28218,12 +28185,12 @@ var Parser;
|
|
|
28218
28185
|
nextTokenJSDoc();
|
|
28219
28186
|
}
|
|
28220
28187
|
}
|
|
28221
|
-
scanner.
|
|
28188
|
+
scanner.setSkipJsDocLeadingAsterisks(false);
|
|
28222
28189
|
return finishNode(moduleTag, pos);
|
|
28223
28190
|
}
|
|
28224
28191
|
const hasDotDotDot = parseOptional(26 /* DotDotDotToken */);
|
|
28225
28192
|
let type = parseTypeOrTypePredicate();
|
|
28226
|
-
scanner.
|
|
28193
|
+
scanner.setSkipJsDocLeadingAsterisks(false);
|
|
28227
28194
|
if (hasDotDotDot) {
|
|
28228
28195
|
type = finishNode(factory2.createJSDocVariadicType(type), pos);
|
|
28229
28196
|
}
|
|
@@ -31786,22 +31753,28 @@ var Parser;
|
|
|
31786
31753
|
if (identifier && !tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration()) {
|
|
31787
31754
|
return parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly);
|
|
31788
31755
|
}
|
|
31756
|
+
const importClause = tryParseImportClause(identifier, afterImportPos, isTypeOnly);
|
|
31757
|
+
const moduleSpecifier = parseModuleSpecifier();
|
|
31758
|
+
const attributes = tryParseImportAttributes();
|
|
31759
|
+
parseSemicolon();
|
|
31760
|
+
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
31761
|
+
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31762
|
+
}
|
|
31763
|
+
function tryParseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks = false) {
|
|
31789
31764
|
let importClause;
|
|
31790
31765
|
if (identifier || // import id
|
|
31791
31766
|
token() === 42 /* AsteriskToken */ || // import *
|
|
31792
31767
|
token() === 19 /* OpenBraceToken */) {
|
|
31793
|
-
importClause = parseImportClause(identifier,
|
|
31768
|
+
importClause = parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks);
|
|
31794
31769
|
parseExpected(161 /* FromKeyword */);
|
|
31795
31770
|
}
|
|
31796
|
-
|
|
31771
|
+
return importClause;
|
|
31772
|
+
}
|
|
31773
|
+
function tryParseImportAttributes() {
|
|
31797
31774
|
const currentToken2 = token();
|
|
31798
|
-
let attributes;
|
|
31799
31775
|
if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
31800
|
-
|
|
31776
|
+
return parseImportAttributes(currentToken2);
|
|
31801
31777
|
}
|
|
31802
|
-
parseSemicolon();
|
|
31803
|
-
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
31804
|
-
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31805
31778
|
}
|
|
31806
31779
|
function parseImportAttribute() {
|
|
31807
31780
|
const pos = getNodePos();
|
|
@@ -31868,10 +31841,14 @@ var Parser;
|
|
|
31868
31841
|
const finished = withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31869
31842
|
return finished;
|
|
31870
31843
|
}
|
|
31871
|
-
function parseImportClause(identifier, pos, isTypeOnly) {
|
|
31844
|
+
function parseImportClause(identifier, pos, isTypeOnly, skipJsDocLeadingAsterisks) {
|
|
31872
31845
|
let namedBindings;
|
|
31873
31846
|
if (!identifier || parseOptional(28 /* CommaToken */)) {
|
|
31847
|
+
if (skipJsDocLeadingAsterisks)
|
|
31848
|
+
scanner.setSkipJsDocLeadingAsterisks(true);
|
|
31874
31849
|
namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(275 /* NamedImports */);
|
|
31850
|
+
if (skipJsDocLeadingAsterisks)
|
|
31851
|
+
scanner.setSkipJsDocLeadingAsterisks(false);
|
|
31875
31852
|
}
|
|
31876
31853
|
return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos);
|
|
31877
31854
|
}
|
|
@@ -32442,6 +32419,9 @@ var Parser;
|
|
|
32442
32419
|
case "throws":
|
|
32443
32420
|
tag = parseThrowsTag(start2, tagName, margin, indentText);
|
|
32444
32421
|
break;
|
|
32422
|
+
case "import":
|
|
32423
|
+
tag = parseImportTag(start2, tagName, margin, indentText);
|
|
32424
|
+
break;
|
|
32445
32425
|
default:
|
|
32446
32426
|
tag = parseUnknownTag(start2, tagName, margin, indentText);
|
|
32447
32427
|
break;
|
|
@@ -32761,13 +32741,32 @@ var Parser;
|
|
|
32761
32741
|
const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
|
|
32762
32742
|
return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2);
|
|
32763
32743
|
}
|
|
32744
|
+
function parseImportTag(start2, tagName, margin, indentText) {
|
|
32745
|
+
const afterImportTagPos = scanner.getTokenFullStart();
|
|
32746
|
+
let identifier;
|
|
32747
|
+
if (isIdentifier2()) {
|
|
32748
|
+
identifier = parseIdentifier();
|
|
32749
|
+
}
|
|
32750
|
+
const importClause = tryParseImportClause(
|
|
32751
|
+
identifier,
|
|
32752
|
+
afterImportTagPos,
|
|
32753
|
+
/*isTypeOnly*/
|
|
32754
|
+
true,
|
|
32755
|
+
/*skipJsDocLeadingAsterisks*/
|
|
32756
|
+
true
|
|
32757
|
+
);
|
|
32758
|
+
const moduleSpecifier = parseModuleSpecifier();
|
|
32759
|
+
const attributes = tryParseImportAttributes();
|
|
32760
|
+
const comments2 = margin !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), margin, indentText) : void 0;
|
|
32761
|
+
return finishNode(factory2.createJSDocImportTag(tagName, importClause, moduleSpecifier, attributes, comments2), start2);
|
|
32762
|
+
}
|
|
32764
32763
|
function parseExpressionWithTypeArgumentsForAugments() {
|
|
32765
32764
|
const usedBrace = parseOptional(19 /* OpenBraceToken */);
|
|
32766
32765
|
const pos = getNodePos();
|
|
32767
32766
|
const expression = parsePropertyAccessEntityNameExpression();
|
|
32768
|
-
scanner.
|
|
32767
|
+
scanner.setSkipJsDocLeadingAsterisks(true);
|
|
32769
32768
|
const typeArguments = tryParseTypeArguments();
|
|
32770
|
-
scanner.
|
|
32769
|
+
scanner.setSkipJsDocLeadingAsterisks(false);
|
|
32771
32770
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
|
32772
32771
|
const res = finishNode(node, pos);
|
|
32773
32772
|
if (usedBrace) {
|
|
@@ -39443,6 +39442,7 @@ function createBinder() {
|
|
|
39443
39442
|
var lastContainer;
|
|
39444
39443
|
var delayedTypeAliases;
|
|
39445
39444
|
var seenThisKeyword;
|
|
39445
|
+
var jsDocImports;
|
|
39446
39446
|
var currentFlow;
|
|
39447
39447
|
var currentBreakTarget;
|
|
39448
39448
|
var currentContinueTarget;
|
|
@@ -39490,6 +39490,7 @@ function createBinder() {
|
|
|
39490
39490
|
file.symbolCount = symbolCount;
|
|
39491
39491
|
file.classifiableNames = classifiableNames;
|
|
39492
39492
|
delayedBindJSDocTypedefTag();
|
|
39493
|
+
bindJSDocImports();
|
|
39493
39494
|
}
|
|
39494
39495
|
file = void 0;
|
|
39495
39496
|
options = void 0;
|
|
@@ -39500,6 +39501,7 @@ function createBinder() {
|
|
|
39500
39501
|
blockScopeContainer = void 0;
|
|
39501
39502
|
lastContainer = void 0;
|
|
39502
39503
|
delayedTypeAliases = void 0;
|
|
39504
|
+
jsDocImports = void 0;
|
|
39503
39505
|
seenThisKeyword = false;
|
|
39504
39506
|
currentFlow = void 0;
|
|
39505
39507
|
currentBreakTarget = void 0;
|
|
@@ -39934,6 +39936,9 @@ function createBinder() {
|
|
|
39934
39936
|
case 340 /* JSDocEnumTag */:
|
|
39935
39937
|
bindJSDocTypeAlias(node);
|
|
39936
39938
|
break;
|
|
39939
|
+
case 351 /* JSDocImportTag */:
|
|
39940
|
+
bindJSDocImportTag(node);
|
|
39941
|
+
break;
|
|
39937
39942
|
case 307 /* SourceFile */: {
|
|
39938
39943
|
bindEachFunctionsFirst(node.statements);
|
|
39939
39944
|
bind(node.endOfFileToken);
|
|
@@ -40666,6 +40671,12 @@ function createBinder() {
|
|
|
40666
40671
|
addDeclarationToSymbol(host.symbol, host, 32 /* Class */);
|
|
40667
40672
|
}
|
|
40668
40673
|
}
|
|
40674
|
+
function bindJSDocImportTag(node) {
|
|
40675
|
+
bind(node.tagName);
|
|
40676
|
+
if (typeof node.comment !== "string") {
|
|
40677
|
+
bindEach(node.comment);
|
|
40678
|
+
}
|
|
40679
|
+
}
|
|
40669
40680
|
function bindOptionalExpression(node, trueTarget, falseTarget) {
|
|
40670
40681
|
doWithConditionalBranches(bind, node, trueTarget, falseTarget);
|
|
40671
40682
|
if (!isOptionalChain(node) || isOutermostOptionalChain(node)) {
|
|
@@ -40982,6 +40993,31 @@ function createBinder() {
|
|
|
40982
40993
|
parent = saveParent;
|
|
40983
40994
|
currentFlow = saveCurrentFlow;
|
|
40984
40995
|
}
|
|
40996
|
+
function bindJSDocImports() {
|
|
40997
|
+
if (jsDocImports === void 0) {
|
|
40998
|
+
return;
|
|
40999
|
+
}
|
|
41000
|
+
const saveContainer = container;
|
|
41001
|
+
const saveLastContainer = lastContainer;
|
|
41002
|
+
const saveBlockScopeContainer = blockScopeContainer;
|
|
41003
|
+
const saveParent = parent;
|
|
41004
|
+
const saveCurrentFlow = currentFlow;
|
|
41005
|
+
for (const jsDocImportTag of jsDocImports) {
|
|
41006
|
+
const host = getJSDocHost(jsDocImportTag);
|
|
41007
|
+
const enclosingContainer = host ? getEnclosingContainer(host) : void 0;
|
|
41008
|
+
const enclosingBlockScopeContainer = host ? getEnclosingBlockScopeContainer(host) : void 0;
|
|
41009
|
+
container = enclosingContainer || file;
|
|
41010
|
+
blockScopeContainer = enclosingBlockScopeContainer || file;
|
|
41011
|
+
currentFlow = initFlowNode({ flags: 2 /* Start */ });
|
|
41012
|
+
parent = jsDocImportTag;
|
|
41013
|
+
bind(jsDocImportTag.importClause);
|
|
41014
|
+
}
|
|
41015
|
+
container = saveContainer;
|
|
41016
|
+
lastContainer = saveLastContainer;
|
|
41017
|
+
blockScopeContainer = saveBlockScopeContainer;
|
|
41018
|
+
parent = saveParent;
|
|
41019
|
+
currentFlow = saveCurrentFlow;
|
|
41020
|
+
}
|
|
40985
41021
|
function checkContextualIdentifier(node) {
|
|
40986
41022
|
if (!file.parseDiagnostics.length && !(node.flags & 33554432 /* Ambient */) && !(node.flags & 16777216 /* JSDoc */) && !isIdentifierName(node)) {
|
|
40987
41023
|
const originalKeywordKind = identifierToKeywordKind(node);
|
|
@@ -41406,6 +41442,8 @@ function createBinder() {
|
|
|
41406
41442
|
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
|
|
41407
41443
|
case 339 /* JSDocOverloadTag */:
|
|
41408
41444
|
return bind(node.typeExpression);
|
|
41445
|
+
case 351 /* JSDocImportTag */:
|
|
41446
|
+
return (jsDocImports || (jsDocImports = [])).push(node);
|
|
41409
41447
|
}
|
|
41410
41448
|
}
|
|
41411
41449
|
function bindPropertyWorker(node) {
|
|
@@ -43252,226 +43290,11 @@ var intrinsicTypeKinds = new Map(Object.entries({
|
|
|
43252
43290
|
Uncapitalize: 3 /* Uncapitalize */,
|
|
43253
43291
|
NoInfer: 4 /* NoInfer */
|
|
43254
43292
|
}));
|
|
43255
|
-
var
|
|
43256
|
-
const baseGet = descriptor ? descriptor.get : valueOrTarget.get;
|
|
43257
|
-
const baseSet = descriptor ? descriptor.set : valueOrTarget.set;
|
|
43258
|
-
return {
|
|
43259
|
-
...descriptor,
|
|
43260
|
-
get: readValue,
|
|
43261
|
-
set: setValue,
|
|
43262
|
-
init(v) {
|
|
43263
|
-
const epoch = this.host.getCurrentSpeculativeEpoch();
|
|
43264
|
-
const values = [];
|
|
43265
|
-
const writtenEpochs = [epoch];
|
|
43266
|
-
values[epoch] = v;
|
|
43267
|
-
return {
|
|
43268
|
-
values,
|
|
43269
|
-
writtenEpochs
|
|
43270
|
-
};
|
|
43271
|
-
}
|
|
43272
|
-
};
|
|
43273
|
-
function readValue() {
|
|
43274
|
-
const internals = baseGet.call(this);
|
|
43275
|
-
if (!internals)
|
|
43276
|
-
return void 0;
|
|
43277
|
-
const {
|
|
43278
|
-
values,
|
|
43279
|
-
writtenEpochs
|
|
43280
|
-
} = internals;
|
|
43281
|
-
const discardedSpeculativeEpochs = this.host.getDiscardedSpeculativeEpochs();
|
|
43282
|
-
const hostEpoch = this instanceof SymbolLinks ? this.symbolEpoch : 0;
|
|
43283
|
-
const symbolDiscarded = discardedSpeculativeEpochs.has(hostEpoch);
|
|
43284
|
-
for (let i = writtenEpochs.length - 1; i >= 0; i--) {
|
|
43285
|
-
if (!symbolDiscarded && discardedSpeculativeEpochs.has(writtenEpochs[i])) {
|
|
43286
|
-
delete values[writtenEpochs[i]];
|
|
43287
|
-
writtenEpochs.splice(i, 1);
|
|
43288
|
-
continue;
|
|
43289
|
-
}
|
|
43290
|
-
return values[writtenEpochs[i]];
|
|
43291
|
-
}
|
|
43292
|
-
return void 0;
|
|
43293
|
-
}
|
|
43294
|
-
function setValue(value) {
|
|
43295
|
-
const internals = baseGet.call(this);
|
|
43296
|
-
const currentSpeculativeEpoch = this.host.getCurrentSpeculativeEpoch();
|
|
43297
|
-
if (!internals) {
|
|
43298
|
-
const values2 = [];
|
|
43299
|
-
const writtenEpochs2 = [];
|
|
43300
|
-
writtenEpochs2.push(currentSpeculativeEpoch);
|
|
43301
|
-
values2[currentSpeculativeEpoch] = value;
|
|
43302
|
-
baseSet.call(this, { values: values2, writtenEpochs: writtenEpochs2 });
|
|
43303
|
-
return value;
|
|
43304
|
-
}
|
|
43305
|
-
const {
|
|
43306
|
-
values,
|
|
43307
|
-
writtenEpochs
|
|
43308
|
-
} = internals;
|
|
43309
|
-
writtenEpochs.push(currentSpeculativeEpoch);
|
|
43310
|
-
values[currentSpeculativeEpoch] = value;
|
|
43311
|
-
return value;
|
|
43312
|
-
}
|
|
43313
|
-
};
|
|
43314
|
-
var SpeculatableLinks = class {
|
|
43315
|
-
constructor(host) {
|
|
43316
|
-
this.host = host;
|
|
43317
|
-
}
|
|
43318
|
-
};
|
|
43319
|
-
var _type, _writeType, _nameType;
|
|
43320
|
-
var SymbolLinks = class extends SpeculatableLinks {
|
|
43321
|
-
constructor(host, symbolEpoch = 0) {
|
|
43322
|
-
super(host);
|
|
43323
|
-
this.symbolEpoch = symbolEpoch;
|
|
43324
|
-
__privateAdd(this, _type, void 0);
|
|
43325
|
-
__privateAdd(this, _writeType, void 0);
|
|
43326
|
-
__privateAdd(this, _nameType, void 0);
|
|
43327
|
-
}
|
|
43328
|
-
get type() {
|
|
43329
|
-
return __privateGet(this, _type);
|
|
43330
|
-
}
|
|
43331
|
-
set type(_) {
|
|
43332
|
-
__privateSet(this, _type, _);
|
|
43333
|
-
}
|
|
43334
|
-
get writeType() {
|
|
43335
|
-
return __privateGet(this, _writeType);
|
|
43336
|
-
}
|
|
43337
|
-
set writeType(_) {
|
|
43338
|
-
__privateSet(this, _writeType, _);
|
|
43339
|
-
}
|
|
43340
|
-
get nameType() {
|
|
43341
|
-
return __privateGet(this, _nameType);
|
|
43342
|
-
}
|
|
43343
|
-
set nameType(_) {
|
|
43344
|
-
__privateSet(this, _nameType, _);
|
|
43345
|
-
}
|
|
43293
|
+
var SymbolLinks = class {
|
|
43346
43294
|
};
|
|
43347
|
-
|
|
43348
|
-
|
|
43349
|
-
|
|
43350
|
-
__decorateClass([
|
|
43351
|
-
SpeculatableCache
|
|
43352
|
-
], SymbolLinks.prototype, "type", 1);
|
|
43353
|
-
__decorateClass([
|
|
43354
|
-
SpeculatableCache
|
|
43355
|
-
], SymbolLinks.prototype, "writeType", 1);
|
|
43356
|
-
__decorateClass([
|
|
43357
|
-
SpeculatableCache
|
|
43358
|
-
], SymbolLinks.prototype, "nameType", 1);
|
|
43359
|
-
var _flags, _resolvedType, _resolvedEnumType, _resolvedSignature, _resolvedSymbol, _resolvedIndexInfo, _effectsSignature, _switchTypes, _contextFreeType, _assertionExpressionType;
|
|
43360
|
-
var NodeLinks = class extends SpeculatableLinks {
|
|
43361
|
-
constructor() {
|
|
43362
|
-
super(...arguments);
|
|
43363
|
-
__privateAdd(this, _flags, 0 /* None */);
|
|
43364
|
-
__privateAdd(this, _resolvedType, void 0);
|
|
43365
|
-
__privateAdd(this, _resolvedEnumType, void 0);
|
|
43366
|
-
__privateAdd(this, _resolvedSignature, void 0);
|
|
43367
|
-
__privateAdd(this, _resolvedSymbol, void 0);
|
|
43368
|
-
__privateAdd(this, _resolvedIndexInfo, void 0);
|
|
43369
|
-
__privateAdd(this, _effectsSignature, void 0);
|
|
43370
|
-
__privateAdd(this, _switchTypes, void 0);
|
|
43371
|
-
__privateAdd(this, _contextFreeType, void 0);
|
|
43372
|
-
__privateAdd(this, _assertionExpressionType, void 0);
|
|
43373
|
-
}
|
|
43374
|
-
get flags() {
|
|
43375
|
-
return __privateGet(this, _flags);
|
|
43376
|
-
}
|
|
43377
|
-
set flags(_) {
|
|
43378
|
-
__privateSet(this, _flags, _);
|
|
43379
|
-
}
|
|
43380
|
-
get resolvedType() {
|
|
43381
|
-
return __privateGet(this, _resolvedType);
|
|
43382
|
-
}
|
|
43383
|
-
set resolvedType(_) {
|
|
43384
|
-
__privateSet(this, _resolvedType, _);
|
|
43385
|
-
}
|
|
43386
|
-
get resolvedEnumType() {
|
|
43387
|
-
return __privateGet(this, _resolvedEnumType);
|
|
43388
|
-
}
|
|
43389
|
-
set resolvedEnumType(_) {
|
|
43390
|
-
__privateSet(this, _resolvedEnumType, _);
|
|
43391
|
-
}
|
|
43392
|
-
get resolvedSignature() {
|
|
43393
|
-
return __privateGet(this, _resolvedSignature);
|
|
43394
|
-
}
|
|
43395
|
-
set resolvedSignature(_) {
|
|
43396
|
-
__privateSet(this, _resolvedSignature, _);
|
|
43397
|
-
}
|
|
43398
|
-
get resolvedSymbol() {
|
|
43399
|
-
return __privateGet(this, _resolvedSymbol);
|
|
43400
|
-
}
|
|
43401
|
-
set resolvedSymbol(_) {
|
|
43402
|
-
__privateSet(this, _resolvedSymbol, _);
|
|
43403
|
-
}
|
|
43404
|
-
get resolvedIndexInfo() {
|
|
43405
|
-
return __privateGet(this, _resolvedIndexInfo);
|
|
43406
|
-
}
|
|
43407
|
-
set resolvedIndexInfo(_) {
|
|
43408
|
-
__privateSet(this, _resolvedIndexInfo, _);
|
|
43409
|
-
}
|
|
43410
|
-
get effectsSignature() {
|
|
43411
|
-
return __privateGet(this, _effectsSignature);
|
|
43412
|
-
}
|
|
43413
|
-
set effectsSignature(_) {
|
|
43414
|
-
__privateSet(this, _effectsSignature, _);
|
|
43415
|
-
}
|
|
43416
|
-
get switchTypes() {
|
|
43417
|
-
return __privateGet(this, _switchTypes);
|
|
43418
|
-
}
|
|
43419
|
-
set switchTypes(_) {
|
|
43420
|
-
__privateSet(this, _switchTypes, _);
|
|
43421
|
-
}
|
|
43422
|
-
get contextFreeType() {
|
|
43423
|
-
return __privateGet(this, _contextFreeType);
|
|
43424
|
-
}
|
|
43425
|
-
set contextFreeType(_) {
|
|
43426
|
-
__privateSet(this, _contextFreeType, _);
|
|
43427
|
-
}
|
|
43428
|
-
get assertionExpressionType() {
|
|
43429
|
-
return __privateGet(this, _assertionExpressionType);
|
|
43430
|
-
}
|
|
43431
|
-
set assertionExpressionType(_) {
|
|
43432
|
-
__privateSet(this, _assertionExpressionType, _);
|
|
43433
|
-
}
|
|
43434
|
-
};
|
|
43435
|
-
_flags = new WeakMap();
|
|
43436
|
-
_resolvedType = new WeakMap();
|
|
43437
|
-
_resolvedEnumType = new WeakMap();
|
|
43438
|
-
_resolvedSignature = new WeakMap();
|
|
43439
|
-
_resolvedSymbol = new WeakMap();
|
|
43440
|
-
_resolvedIndexInfo = new WeakMap();
|
|
43441
|
-
_effectsSignature = new WeakMap();
|
|
43442
|
-
_switchTypes = new WeakMap();
|
|
43443
|
-
_contextFreeType = new WeakMap();
|
|
43444
|
-
_assertionExpressionType = new WeakMap();
|
|
43445
|
-
__decorateClass([
|
|
43446
|
-
SpeculatableCache
|
|
43447
|
-
], NodeLinks.prototype, "flags", 1);
|
|
43448
|
-
__decorateClass([
|
|
43449
|
-
SpeculatableCache
|
|
43450
|
-
], NodeLinks.prototype, "resolvedType", 1);
|
|
43451
|
-
__decorateClass([
|
|
43452
|
-
SpeculatableCache
|
|
43453
|
-
], NodeLinks.prototype, "resolvedEnumType", 1);
|
|
43454
|
-
__decorateClass([
|
|
43455
|
-
SpeculatableCache
|
|
43456
|
-
], NodeLinks.prototype, "resolvedSignature", 1);
|
|
43457
|
-
__decorateClass([
|
|
43458
|
-
SpeculatableCache
|
|
43459
|
-
], NodeLinks.prototype, "resolvedSymbol", 1);
|
|
43460
|
-
__decorateClass([
|
|
43461
|
-
SpeculatableCache
|
|
43462
|
-
], NodeLinks.prototype, "resolvedIndexInfo", 1);
|
|
43463
|
-
__decorateClass([
|
|
43464
|
-
SpeculatableCache
|
|
43465
|
-
], NodeLinks.prototype, "effectsSignature", 1);
|
|
43466
|
-
__decorateClass([
|
|
43467
|
-
SpeculatableCache
|
|
43468
|
-
], NodeLinks.prototype, "switchTypes", 1);
|
|
43469
|
-
__decorateClass([
|
|
43470
|
-
SpeculatableCache
|
|
43471
|
-
], NodeLinks.prototype, "contextFreeType", 1);
|
|
43472
|
-
__decorateClass([
|
|
43473
|
-
SpeculatableCache
|
|
43474
|
-
], NodeLinks.prototype, "assertionExpressionType", 1);
|
|
43295
|
+
function NodeLinks() {
|
|
43296
|
+
this.flags = 0 /* None */;
|
|
43297
|
+
}
|
|
43475
43298
|
function getNodeId(node) {
|
|
43476
43299
|
if (!node.id) {
|
|
43477
43300
|
node.id = nextNodeId;
|
|
@@ -43491,18 +43314,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
43491
43314
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
43492
43315
|
}
|
|
43493
43316
|
function createTypeChecker(host) {
|
|
43494
|
-
var
|
|
43495
|
-
var currentSpeculativeEpoch = 0;
|
|
43496
|
-
var discardedSpeculativeEpochs = /* @__PURE__ */ new Set();
|
|
43497
|
-
var speculationHost = {
|
|
43498
|
-
getCurrentSpeculativeEpoch() {
|
|
43499
|
-
return currentSpeculativeEpoch;
|
|
43500
|
-
},
|
|
43501
|
-
getDiscardedSpeculativeEpochs() {
|
|
43502
|
-
return discardedSpeculativeEpochs;
|
|
43503
|
-
}
|
|
43504
|
-
};
|
|
43505
|
-
var deferredDiagnosticsCallbacks = registerSpeculativeCache([]);
|
|
43317
|
+
var deferredDiagnosticsCallbacks = [];
|
|
43506
43318
|
var addLazyDiagnostic = (arg) => {
|
|
43507
43319
|
deferredDiagnosticsCallbacks.push(arg);
|
|
43508
43320
|
};
|
|
@@ -44438,12 +44250,12 @@ function createTypeChecker(host) {
|
|
|
44438
44250
|
var mergedSymbols = [];
|
|
44439
44251
|
var symbolLinks = [];
|
|
44440
44252
|
var nodeLinks = [];
|
|
44441
|
-
var flowLoopCaches =
|
|
44442
|
-
var flowLoopNodes =
|
|
44443
|
-
var flowLoopKeys =
|
|
44444
|
-
var flowLoopTypes =
|
|
44445
|
-
var sharedFlowNodes =
|
|
44446
|
-
var sharedFlowTypes =
|
|
44253
|
+
var flowLoopCaches = [];
|
|
44254
|
+
var flowLoopNodes = [];
|
|
44255
|
+
var flowLoopKeys = [];
|
|
44256
|
+
var flowLoopTypes = [];
|
|
44257
|
+
var sharedFlowNodes = [];
|
|
44258
|
+
var sharedFlowTypes = [];
|
|
44447
44259
|
var flowNodeReachable = [];
|
|
44448
44260
|
var flowNodePostSuper = [];
|
|
44449
44261
|
var potentialThisCollisions = [];
|
|
@@ -44452,17 +44264,17 @@ function createTypeChecker(host) {
|
|
|
44452
44264
|
var potentialReflectCollisions = [];
|
|
44453
44265
|
var potentialUnusedRenamedBindingElementsInTypes = [];
|
|
44454
44266
|
var awaitedTypeStack = [];
|
|
44455
|
-
var diagnostics =
|
|
44456
|
-
var suggestionDiagnostics =
|
|
44267
|
+
var diagnostics = createDiagnosticCollection();
|
|
44268
|
+
var suggestionDiagnostics = createDiagnosticCollection();
|
|
44457
44269
|
var typeofType = createTypeofType();
|
|
44458
44270
|
var _jsxNamespace;
|
|
44459
44271
|
var _jsxFactoryEntity;
|
|
44460
|
-
var subtypeRelation =
|
|
44461
|
-
var strictSubtypeRelation =
|
|
44462
|
-
var assignableRelation =
|
|
44463
|
-
var comparableRelation =
|
|
44464
|
-
var identityRelation =
|
|
44465
|
-
var enumRelation =
|
|
44272
|
+
var subtypeRelation = /* @__PURE__ */ new Map();
|
|
44273
|
+
var strictSubtypeRelation = /* @__PURE__ */ new Map();
|
|
44274
|
+
var assignableRelation = /* @__PURE__ */ new Map();
|
|
44275
|
+
var comparableRelation = /* @__PURE__ */ new Map();
|
|
44276
|
+
var identityRelation = /* @__PURE__ */ new Map();
|
|
44277
|
+
var enumRelation = /* @__PURE__ */ new Map();
|
|
44466
44278
|
var builtinGlobals = createSymbolTable();
|
|
44467
44279
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
44468
44280
|
var suggestedExtensions = [
|
|
@@ -44641,8 +44453,7 @@ function createTypeChecker(host) {
|
|
|
44641
44453
|
function createSymbol(flags, name, checkFlags) {
|
|
44642
44454
|
symbolCount++;
|
|
44643
44455
|
const symbol = new Symbol12(flags | 33554432 /* Transient */, name);
|
|
44644
|
-
symbol.
|
|
44645
|
-
symbol.links = new SymbolLinks(speculationHost, symbol.epoch);
|
|
44456
|
+
symbol.links = new SymbolLinks();
|
|
44646
44457
|
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
44647
44458
|
return symbol;
|
|
44648
44459
|
}
|
|
@@ -44900,11 +44711,11 @@ function createTypeChecker(host) {
|
|
|
44900
44711
|
if (symbol.flags & 33554432 /* Transient */)
|
|
44901
44712
|
return symbol.links;
|
|
44902
44713
|
const id = getSymbolId(symbol);
|
|
44903
|
-
return symbolLinks[id] ?? (symbolLinks[id] = new SymbolLinks(
|
|
44714
|
+
return symbolLinks[id] ?? (symbolLinks[id] = new SymbolLinks());
|
|
44904
44715
|
}
|
|
44905
44716
|
function getNodeLinks(node) {
|
|
44906
44717
|
const nodeId = getNodeId(node);
|
|
44907
|
-
return nodeLinks[nodeId]
|
|
44718
|
+
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
44908
44719
|
}
|
|
44909
44720
|
function isGlobalSourceFile(node) {
|
|
44910
44721
|
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
@@ -45312,6 +45123,7 @@ function createTypeChecker(host) {
|
|
|
45312
45123
|
case 346 /* JSDocTypedefTag */:
|
|
45313
45124
|
case 338 /* JSDocCallbackTag */:
|
|
45314
45125
|
case 340 /* JSDocEnumTag */:
|
|
45126
|
+
case 351 /* JSDocImportTag */:
|
|
45315
45127
|
const root = getJSDocRoot(location);
|
|
45316
45128
|
if (root) {
|
|
45317
45129
|
location = root.parent;
|
|
@@ -46804,7 +46616,7 @@ function createTypeChecker(host) {
|
|
|
46804
46616
|
return ambientModule;
|
|
46805
46617
|
}
|
|
46806
46618
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
46807
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
46619
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isInJSFile(location) && isJSDocImportTag(location) ? location.moduleSpecifier : void 0) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
46808
46620
|
location.initializer,
|
|
46809
46621
|
/*requireStringLiteralLikeArgument*/
|
|
46810
46622
|
true
|
|
@@ -51105,19 +50917,20 @@ function createTypeChecker(host) {
|
|
|
51105
50917
|
case 273 /* ImportClause */: {
|
|
51106
50918
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51107
50919
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
|
50920
|
+
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
|
50921
|
+
const isTypeOnly = isJSDocImportTag(node.parent);
|
|
51108
50922
|
addResult(
|
|
51109
50923
|
factory.createImportDeclaration(
|
|
51110
50924
|
/*modifiers*/
|
|
51111
50925
|
void 0,
|
|
51112
50926
|
factory.createImportClause(
|
|
51113
|
-
|
|
51114
|
-
false,
|
|
50927
|
+
isTypeOnly,
|
|
51115
50928
|
factory.createIdentifier(localName),
|
|
51116
50929
|
/*namedBindings*/
|
|
51117
50930
|
void 0
|
|
51118
50931
|
),
|
|
51119
50932
|
specifier2,
|
|
51120
|
-
|
|
50933
|
+
attributes
|
|
51121
50934
|
),
|
|
51122
50935
|
0 /* None */
|
|
51123
50936
|
);
|
|
@@ -51126,13 +50939,13 @@ function createTypeChecker(host) {
|
|
|
51126
50939
|
case 274 /* NamespaceImport */: {
|
|
51127
50940
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51128
50941
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
|
50942
|
+
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
|
51129
50943
|
addResult(
|
|
51130
50944
|
factory.createImportDeclaration(
|
|
51131
50945
|
/*modifiers*/
|
|
51132
50946
|
void 0,
|
|
51133
50947
|
factory.createImportClause(
|
|
51134
|
-
|
|
51135
|
-
false,
|
|
50948
|
+
isTypeOnly,
|
|
51136
50949
|
/*name*/
|
|
51137
50950
|
void 0,
|
|
51138
50951
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
@@ -51160,13 +50973,13 @@ function createTypeChecker(host) {
|
|
|
51160
50973
|
case 276 /* ImportSpecifier */: {
|
|
51161
50974
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
51162
50975
|
const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
|
50976
|
+
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
|
51163
50977
|
addResult(
|
|
51164
50978
|
factory.createImportDeclaration(
|
|
51165
50979
|
/*modifiers*/
|
|
51166
50980
|
void 0,
|
|
51167
50981
|
factory.createImportClause(
|
|
51168
|
-
|
|
51169
|
-
false,
|
|
50982
|
+
isTypeOnly,
|
|
51170
50983
|
/*name*/
|
|
51171
50984
|
void 0,
|
|
51172
50985
|
factory.createNamedImports([
|
|
@@ -59486,7 +59299,7 @@ function createTypeChecker(host) {
|
|
|
59486
59299
|
function getObjectTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
59487
59300
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
59488
59301
|
const links = getNodeLinks(declaration);
|
|
59489
|
-
const target = type.objectFlags & 4 /* Reference */ ?
|
|
59302
|
+
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
59490
59303
|
let typeParameters = links.outerTypeParameters;
|
|
59491
59304
|
if (!typeParameters) {
|
|
59492
59305
|
let outerTypeParameters = getOuterTypeParameters(
|
|
@@ -71980,8 +71793,8 @@ function createTypeChecker(host) {
|
|
|
71980
71793
|
Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
|
|
71981
71794
|
const args = getEffectiveCallArguments(node);
|
|
71982
71795
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
71796
|
+
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
71983
71797
|
let candidatesForArgumentError;
|
|
71984
|
-
let candidateArgumentErrors;
|
|
71985
71798
|
let candidateForArgumentArityError;
|
|
71986
71799
|
let candidateForTypeArgumentError;
|
|
71987
71800
|
let result;
|
|
@@ -72012,10 +71825,18 @@ function createTypeChecker(host) {
|
|
|
72012
71825
|
if (headMessage) {
|
|
72013
71826
|
chain = chainDiagnosticMessages(chain, headMessage);
|
|
72014
71827
|
}
|
|
72015
|
-
const diags =
|
|
71828
|
+
const diags = getSignatureApplicabilityError(
|
|
71829
|
+
node,
|
|
71830
|
+
args,
|
|
71831
|
+
last2,
|
|
71832
|
+
assignableRelation,
|
|
71833
|
+
0 /* Normal */,
|
|
71834
|
+
/*reportErrors*/
|
|
71835
|
+
true,
|
|
71836
|
+
() => chain
|
|
71837
|
+
);
|
|
72016
71838
|
if (diags) {
|
|
72017
|
-
for (
|
|
72018
|
-
d = prefixDiagnosticWithMessageChain(d, chain);
|
|
71839
|
+
for (const d of diags) {
|
|
72019
71840
|
if (last2.declaration && candidatesForArgumentError.length > 3) {
|
|
72020
71841
|
addRelatedInfo(d, createDiagnosticForNode(last2.declaration, Diagnostics.The_last_overload_is_declared_here));
|
|
72021
71842
|
}
|
|
@@ -72040,14 +71861,23 @@ function createTypeChecker(host) {
|
|
|
72040
71861
|
candidates.length,
|
|
72041
71862
|
signatureToString(c)
|
|
72042
71863
|
);
|
|
72043
|
-
const diags2 =
|
|
71864
|
+
const diags2 = getSignatureApplicabilityError(
|
|
71865
|
+
node,
|
|
71866
|
+
args,
|
|
71867
|
+
c,
|
|
71868
|
+
assignableRelation,
|
|
71869
|
+
0 /* Normal */,
|
|
71870
|
+
/*reportErrors*/
|
|
71871
|
+
true,
|
|
71872
|
+
chain2
|
|
71873
|
+
);
|
|
72044
71874
|
if (diags2) {
|
|
72045
71875
|
if (diags2.length <= min2) {
|
|
72046
71876
|
min2 = diags2.length;
|
|
72047
71877
|
minIndex = i;
|
|
72048
71878
|
}
|
|
72049
71879
|
max = Math.max(max, diags2.length);
|
|
72050
|
-
allDiagnostics.push(
|
|
71880
|
+
allDiagnostics.push(diags2);
|
|
72051
71881
|
} else {
|
|
72052
71882
|
Debug.fail("No error for 3 or fewer overload signatures");
|
|
72053
71883
|
}
|
|
@@ -72096,7 +71926,6 @@ function createTypeChecker(host) {
|
|
|
72096
71926
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
72097
71927
|
var _a, _b;
|
|
72098
71928
|
const oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
72099
|
-
const oldCandidateArgumentErrors = candidateArgumentErrors;
|
|
72100
71929
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
72101
71930
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
72102
71931
|
const failedSignatureDeclarations = ((_b = (_a = failed.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
@@ -72110,13 +71939,11 @@ function createTypeChecker(host) {
|
|
|
72110
71939
|
}
|
|
72111
71940
|
}
|
|
72112
71941
|
candidatesForArgumentError = oldCandidatesForArgumentError;
|
|
72113
|
-
candidateArgumentErrors = oldCandidateArgumentErrors;
|
|
72114
71942
|
candidateForArgumentArityError = oldCandidateForArgumentArityError;
|
|
72115
71943
|
candidateForTypeArgumentError = oldCandidateForTypeArgumentError;
|
|
72116
71944
|
}
|
|
72117
71945
|
function chooseOverload(candidates2, relation, isSingleNonGenericCandidate2, signatureHelpTrailingComma2 = false) {
|
|
72118
71946
|
candidatesForArgumentError = void 0;
|
|
72119
|
-
candidateArgumentErrors = void 0;
|
|
72120
71947
|
candidateForArgumentArityError = void 0;
|
|
72121
71948
|
candidateForTypeArgumentError = void 0;
|
|
72122
71949
|
if (isSingleNonGenericCandidate2) {
|
|
@@ -72124,113 +71951,101 @@ function createTypeChecker(host) {
|
|
|
72124
71951
|
if (some(typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
72125
71952
|
return void 0;
|
|
72126
71953
|
}
|
|
72127
|
-
|
|
72128
|
-
if (diags = getSignatureApplicabilityError(
|
|
71954
|
+
if (getSignatureApplicabilityError(
|
|
72129
71955
|
node,
|
|
72130
71956
|
args,
|
|
72131
71957
|
candidate,
|
|
72132
71958
|
relation,
|
|
72133
71959
|
0 /* Normal */,
|
|
72134
71960
|
/*reportErrors*/
|
|
72135
|
-
|
|
71961
|
+
false,
|
|
72136
71962
|
/*containingMessageChain*/
|
|
72137
71963
|
void 0
|
|
72138
71964
|
)) {
|
|
72139
71965
|
candidatesForArgumentError = [candidate];
|
|
72140
|
-
candidateArgumentErrors = [diags];
|
|
72141
71966
|
return void 0;
|
|
72142
71967
|
}
|
|
72143
71968
|
return candidate;
|
|
72144
71969
|
}
|
|
72145
|
-
const initialCheckMode = !isDecorator2 && !isSingleNonGenericCandidate2 && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
72146
71970
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
72147
71971
|
const candidate = candidates2[candidateIndex];
|
|
72148
71972
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
72149
71973
|
continue;
|
|
72150
71974
|
}
|
|
72151
|
-
|
|
72152
|
-
|
|
72153
|
-
|
|
72154
|
-
let
|
|
72155
|
-
if (
|
|
72156
|
-
|
|
72157
|
-
|
|
72158
|
-
|
|
72159
|
-
|
|
72160
|
-
|
|
72161
|
-
|
|
72162
|
-
|
|
72163
|
-
|
|
72164
|
-
|
|
72165
|
-
candidateForTypeArgumentError = candidate;
|
|
72166
|
-
return false;
|
|
72167
|
-
}
|
|
72168
|
-
} else {
|
|
72169
|
-
inferenceContext = createInferenceContext(
|
|
72170
|
-
candidate.typeParameters,
|
|
72171
|
-
candidate,
|
|
72172
|
-
/*flags*/
|
|
72173
|
-
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72174
|
-
);
|
|
72175
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72176
|
-
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
71975
|
+
let checkCandidate;
|
|
71976
|
+
let inferenceContext;
|
|
71977
|
+
if (candidate.typeParameters) {
|
|
71978
|
+
let typeArgumentTypes;
|
|
71979
|
+
if (some(typeArguments)) {
|
|
71980
|
+
typeArgumentTypes = checkTypeArguments(
|
|
71981
|
+
candidate,
|
|
71982
|
+
typeArguments,
|
|
71983
|
+
/*reportErrors*/
|
|
71984
|
+
false
|
|
71985
|
+
);
|
|
71986
|
+
if (!typeArgumentTypes) {
|
|
71987
|
+
candidateForTypeArgumentError = candidate;
|
|
71988
|
+
continue;
|
|
72177
71989
|
}
|
|
72178
|
-
|
|
71990
|
+
} else {
|
|
71991
|
+
inferenceContext = createInferenceContext(
|
|
71992
|
+
candidate.typeParameters,
|
|
71993
|
+
candidate,
|
|
71994
|
+
/*flags*/
|
|
71995
|
+
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
71996
|
+
);
|
|
71997
|
+
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
71998
|
+
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
71999
|
+
}
|
|
72000
|
+
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
72001
|
+
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72002
|
+
candidateForArgumentArityError = checkCandidate;
|
|
72003
|
+
continue;
|
|
72004
|
+
}
|
|
72005
|
+
} else {
|
|
72006
|
+
checkCandidate = candidate;
|
|
72007
|
+
}
|
|
72008
|
+
if (getSignatureApplicabilityError(
|
|
72009
|
+
node,
|
|
72010
|
+
args,
|
|
72011
|
+
checkCandidate,
|
|
72012
|
+
relation,
|
|
72013
|
+
argCheckMode,
|
|
72014
|
+
/*reportErrors*/
|
|
72015
|
+
false,
|
|
72016
|
+
/*containingMessageChain*/
|
|
72017
|
+
void 0
|
|
72018
|
+
)) {
|
|
72019
|
+
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
72020
|
+
continue;
|
|
72021
|
+
}
|
|
72022
|
+
if (argCheckMode) {
|
|
72023
|
+
argCheckMode = 0 /* Normal */;
|
|
72024
|
+
if (inferenceContext) {
|
|
72025
|
+
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72026
|
+
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72179
72027
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72180
72028
|
candidateForArgumentArityError = checkCandidate;
|
|
72181
|
-
|
|
72029
|
+
continue;
|
|
72182
72030
|
}
|
|
72183
|
-
} else {
|
|
72184
|
-
checkCandidate = candidate;
|
|
72185
72031
|
}
|
|
72186
|
-
|
|
72187
|
-
if (diags = getSignatureApplicabilityError(
|
|
72032
|
+
if (getSignatureApplicabilityError(
|
|
72188
72033
|
node,
|
|
72189
72034
|
args,
|
|
72190
72035
|
checkCandidate,
|
|
72191
72036
|
relation,
|
|
72192
72037
|
argCheckMode,
|
|
72193
72038
|
/*reportErrors*/
|
|
72194
|
-
|
|
72039
|
+
false,
|
|
72195
72040
|
/*containingMessageChain*/
|
|
72196
72041
|
void 0
|
|
72197
72042
|
)) {
|
|
72198
72043
|
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
72199
|
-
|
|
72200
|
-
return false;
|
|
72201
|
-
}
|
|
72202
|
-
if (argCheckMode) {
|
|
72203
|
-
argCheckMode = 0 /* Normal */;
|
|
72204
|
-
if (inferenceContext) {
|
|
72205
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72206
|
-
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72207
|
-
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72208
|
-
candidateForArgumentArityError = checkCandidate;
|
|
72209
|
-
return false;
|
|
72210
|
-
}
|
|
72211
|
-
}
|
|
72212
|
-
if (diags = getSignatureApplicabilityError(
|
|
72213
|
-
node,
|
|
72214
|
-
args,
|
|
72215
|
-
checkCandidate,
|
|
72216
|
-
relation,
|
|
72217
|
-
argCheckMode,
|
|
72218
|
-
/*reportErrors*/
|
|
72219
|
-
relation === assignableRelation,
|
|
72220
|
-
/*containingMessageChain*/
|
|
72221
|
-
void 0
|
|
72222
|
-
)) {
|
|
72223
|
-
(candidatesForArgumentError || (candidatesForArgumentError = [])).push(checkCandidate);
|
|
72224
|
-
(candidateArgumentErrors || (candidateArgumentErrors = [])).push(diags);
|
|
72225
|
-
return false;
|
|
72226
|
-
}
|
|
72044
|
+
continue;
|
|
72227
72045
|
}
|
|
72228
|
-
candidates2[candidateIndex] = checkCandidate;
|
|
72229
|
-
return checkCandidate;
|
|
72230
|
-
});
|
|
72231
|
-
if (result2) {
|
|
72232
|
-
return result2;
|
|
72233
72046
|
}
|
|
72047
|
+
candidates2[candidateIndex] = checkCandidate;
|
|
72048
|
+
return checkCandidate;
|
|
72234
72049
|
}
|
|
72235
72050
|
return void 0;
|
|
72236
72051
|
}
|
|
@@ -77899,6 +77714,9 @@ function createTypeChecker(host) {
|
|
|
77899
77714
|
error(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
|
77900
77715
|
}
|
|
77901
77716
|
}
|
|
77717
|
+
function checkJSDocImportTag(node) {
|
|
77718
|
+
checkImportAttributes(node);
|
|
77719
|
+
}
|
|
77902
77720
|
function checkJSDocImplementsTag(node) {
|
|
77903
77721
|
const classLike = getEffectiveJSDocHost(node);
|
|
77904
77722
|
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
|
@@ -81140,7 +80958,7 @@ function createTypeChecker(host) {
|
|
|
81140
80958
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
81141
80959
|
return grammarErrorOnNode(node, message);
|
|
81142
80960
|
}
|
|
81143
|
-
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
80961
|
+
if (isImportDeclaration(declaration) || isJSDocImportTag(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
81144
80962
|
return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
81145
80963
|
}
|
|
81146
80964
|
if (override) {
|
|
@@ -81591,6 +81409,8 @@ function createTypeChecker(host) {
|
|
|
81591
81409
|
return checkJSDocSatisfiesTag(node);
|
|
81592
81410
|
case 343 /* JSDocThisTag */:
|
|
81593
81411
|
return checkJSDocThisTag(node);
|
|
81412
|
+
case 351 /* JSDocImportTag */:
|
|
81413
|
+
return checkJSDocImportTag(node);
|
|
81594
81414
|
case 199 /* IndexedAccessType */:
|
|
81595
81415
|
return checkIndexedAccessType(node);
|
|
81596
81416
|
case 200 /* MappedType */:
|
|
@@ -82394,7 +82214,7 @@ function createTypeChecker(host) {
|
|
|
82394
82214
|
return void 0;
|
|
82395
82215
|
case 11 /* StringLiteral */:
|
|
82396
82216
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
82397
|
-
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
|
|
82217
|
+
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || isInJSFile(node) && isJSDocImportTag(node.parent) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
|
|
82398
82218
|
node.parent,
|
|
82399
82219
|
/*requireStringLiteralLikeArgument*/
|
|
82400
82220
|
false
|
|
@@ -83416,78 +83236,6 @@ function createTypeChecker(host) {
|
|
|
83416
83236
|
}
|
|
83417
83237
|
return getDeclarationOfKind(moduleSymbol, 307 /* SourceFile */);
|
|
83418
83238
|
}
|
|
83419
|
-
function speculate(cb) {
|
|
83420
|
-
currentSpeculativeEpoch++;
|
|
83421
|
-
const startEpoch = currentSpeculativeEpoch;
|
|
83422
|
-
const initialState = snapshotCheckerState();
|
|
83423
|
-
const result = cb();
|
|
83424
|
-
const endEpoch = currentSpeculativeEpoch;
|
|
83425
|
-
currentSpeculativeEpoch++;
|
|
83426
|
-
if (!result) {
|
|
83427
|
-
for (let i = startEpoch; i <= endEpoch; i++) {
|
|
83428
|
-
discardedSpeculativeEpochs.add(i);
|
|
83429
|
-
}
|
|
83430
|
-
restoreCheckerState(initialState);
|
|
83431
|
-
return void 0;
|
|
83432
|
-
}
|
|
83433
|
-
return result;
|
|
83434
|
-
}
|
|
83435
|
-
function registerSpeculativeCache(collection) {
|
|
83436
|
-
speculativeCaches.push(collection);
|
|
83437
|
-
return collection;
|
|
83438
|
-
}
|
|
83439
|
-
function snapshotCheckerState() {
|
|
83440
|
-
const state = { restores: map(speculativeCaches, save) };
|
|
83441
|
-
return state;
|
|
83442
|
-
function save(cache) {
|
|
83443
|
-
if (Array.isArray(cache)) {
|
|
83444
|
-
return saveArray(cache);
|
|
83445
|
-
} else if (cache instanceof Map) {
|
|
83446
|
-
return saveMap(cache);
|
|
83447
|
-
} else if (cache instanceof Set) {
|
|
83448
|
-
return saveSet(cache);
|
|
83449
|
-
} else if (cache.add && cache.getDiagnostics) {
|
|
83450
|
-
return saveDiagnosticCollection(cache);
|
|
83451
|
-
}
|
|
83452
|
-
return Debug.fail("Unknown speculative cache type");
|
|
83453
|
-
}
|
|
83454
|
-
function saveArray(cache) {
|
|
83455
|
-
const original = cache.slice();
|
|
83456
|
-
return () => {
|
|
83457
|
-
cache.length = 0;
|
|
83458
|
-
cache.push(...original);
|
|
83459
|
-
};
|
|
83460
|
-
}
|
|
83461
|
-
function saveMap(cache) {
|
|
83462
|
-
const original = arrayFrom(cache.entries());
|
|
83463
|
-
return () => {
|
|
83464
|
-
cache.clear();
|
|
83465
|
-
for (const [k, v] of original) {
|
|
83466
|
-
cache.set(k, v);
|
|
83467
|
-
}
|
|
83468
|
-
};
|
|
83469
|
-
}
|
|
83470
|
-
function saveSet(cache) {
|
|
83471
|
-
const original = arrayFrom(cache.entries());
|
|
83472
|
-
return () => {
|
|
83473
|
-
cache.clear();
|
|
83474
|
-
for (const [_, v] of original) {
|
|
83475
|
-
cache.add(v);
|
|
83476
|
-
}
|
|
83477
|
-
};
|
|
83478
|
-
}
|
|
83479
|
-
function saveDiagnosticCollection(cache) {
|
|
83480
|
-
const c = cache.checkpoint();
|
|
83481
|
-
return () => {
|
|
83482
|
-
cache.revert(c);
|
|
83483
|
-
};
|
|
83484
|
-
}
|
|
83485
|
-
}
|
|
83486
|
-
function restoreCheckerState(state) {
|
|
83487
|
-
for (const restore of state.restores) {
|
|
83488
|
-
restore();
|
|
83489
|
-
}
|
|
83490
|
-
}
|
|
83491
83239
|
function initializeTypeChecker() {
|
|
83492
83240
|
for (const file of host.getSourceFiles()) {
|
|
83493
83241
|
bindSourceFile(file, compilerOptions);
|
|
@@ -86708,13 +86456,13 @@ var visitEachChildTable = {
|
|
|
86708
86456
|
);
|
|
86709
86457
|
},
|
|
86710
86458
|
// Transformation nodes
|
|
86711
|
-
[
|
|
86459
|
+
[354 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
86712
86460
|
return context.factory.updatePartiallyEmittedExpression(
|
|
86713
86461
|
node,
|
|
86714
86462
|
Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression))
|
|
86715
86463
|
);
|
|
86716
86464
|
},
|
|
86717
|
-
[
|
|
86465
|
+
[355 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
86718
86466
|
return context.factory.updateCommaListExpression(
|
|
86719
86467
|
node,
|
|
86720
86468
|
nodesVisitor(node.elements, visitor, isExpression)
|
|
@@ -87170,6 +86918,7 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
87170
86918
|
const exportedBindings = [];
|
|
87171
86919
|
const uniqueExports = /* @__PURE__ */ new Map();
|
|
87172
86920
|
let exportedNames;
|
|
86921
|
+
let exportedFunctions;
|
|
87173
86922
|
let hasExportDefault = false;
|
|
87174
86923
|
let exportEquals;
|
|
87175
86924
|
let hasExportStarsToExportValues = false;
|
|
@@ -87228,6 +86977,7 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
87228
86977
|
break;
|
|
87229
86978
|
case 262 /* FunctionDeclaration */:
|
|
87230
86979
|
if (hasSyntacticModifier(node, 32 /* Export */)) {
|
|
86980
|
+
exportedFunctions = append(exportedFunctions, node);
|
|
87231
86981
|
if (hasSyntacticModifier(node, 2048 /* Default */)) {
|
|
87232
86982
|
if (!hasExportDefault) {
|
|
87233
86983
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node));
|
|
@@ -87238,7 +86988,6 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
87238
86988
|
if (!uniqueExports.get(idText(name))) {
|
|
87239
86989
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
|
87240
86990
|
uniqueExports.set(idText(name), true);
|
|
87241
|
-
exportedNames = append(exportedNames, name);
|
|
87242
86991
|
}
|
|
87243
86992
|
}
|
|
87244
86993
|
}
|
|
@@ -87266,7 +87015,7 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
87266
87015
|
if (externalHelpersImportDeclaration) {
|
|
87267
87016
|
externalImports.unshift(externalHelpersImportDeclaration);
|
|
87268
87017
|
}
|
|
87269
|
-
return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, externalHelpersImportDeclaration };
|
|
87018
|
+
return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
|
|
87270
87019
|
function addExportedNamesForExportDeclaration(node) {
|
|
87271
87020
|
for (const specifier of cast(node.exportClause, isNamedExports).elements) {
|
|
87272
87021
|
if (!uniqueExports.get(idText(specifier.name))) {
|
|
@@ -90369,7 +90118,7 @@ function transformClassFields(context) {
|
|
|
90369
90118
|
/*discarded*/
|
|
90370
90119
|
true
|
|
90371
90120
|
);
|
|
90372
|
-
case
|
|
90121
|
+
case 355 /* CommaListExpression */:
|
|
90373
90122
|
return visitCommaListExpression(
|
|
90374
90123
|
node,
|
|
90375
90124
|
/*discarded*/
|
|
@@ -93462,7 +93211,7 @@ function transformESDecorators(context) {
|
|
|
93462
93211
|
return visitForStatement(node);
|
|
93463
93212
|
case 244 /* ExpressionStatement */:
|
|
93464
93213
|
return visitExpressionStatement(node);
|
|
93465
|
-
case
|
|
93214
|
+
case 355 /* CommaListExpression */:
|
|
93466
93215
|
return visitCommaListExpression(
|
|
93467
93216
|
node,
|
|
93468
93217
|
/*discarded*/
|
|
@@ -93474,7 +93223,7 @@ function transformESDecorators(context) {
|
|
|
93474
93223
|
/*discarded*/
|
|
93475
93224
|
false
|
|
93476
93225
|
);
|
|
93477
|
-
case
|
|
93226
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
93478
93227
|
return visitPartiallyEmittedExpression(
|
|
93479
93228
|
node,
|
|
93480
93229
|
/*discarded*/
|
|
@@ -93560,7 +93309,7 @@ function transformESDecorators(context) {
|
|
|
93560
93309
|
/*discarded*/
|
|
93561
93310
|
true
|
|
93562
93311
|
);
|
|
93563
|
-
case
|
|
93312
|
+
case 355 /* CommaListExpression */:
|
|
93564
93313
|
return visitCommaListExpression(
|
|
93565
93314
|
node,
|
|
93566
93315
|
/*discarded*/
|
|
@@ -96151,7 +95900,7 @@ function transformES2018(context) {
|
|
|
96151
95900
|
return visitObjectLiteralExpression(node);
|
|
96152
95901
|
case 226 /* BinaryExpression */:
|
|
96153
95902
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
96154
|
-
case
|
|
95903
|
+
case 355 /* CommaListExpression */:
|
|
96155
95904
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
96156
95905
|
case 299 /* CatchClause */:
|
|
96157
95906
|
return visitCatchClause(node);
|
|
@@ -99374,7 +99123,7 @@ function transformES2015(context) {
|
|
|
99374
99123
|
return visitParenthesizedExpression(node, expressionResultIsUnused2);
|
|
99375
99124
|
case 226 /* BinaryExpression */:
|
|
99376
99125
|
return visitBinaryExpression(node, expressionResultIsUnused2);
|
|
99377
|
-
case
|
|
99126
|
+
case 355 /* CommaListExpression */:
|
|
99378
99127
|
return visitCommaListExpression(node, expressionResultIsUnused2);
|
|
99379
99128
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
99380
99129
|
case 16 /* TemplateHead */:
|
|
@@ -102669,7 +102418,7 @@ function transformGenerators(context) {
|
|
|
102669
102418
|
switch (node.kind) {
|
|
102670
102419
|
case 226 /* BinaryExpression */:
|
|
102671
102420
|
return visitBinaryExpression(node);
|
|
102672
|
-
case
|
|
102421
|
+
case 355 /* CommaListExpression */:
|
|
102673
102422
|
return visitCommaListExpression(node);
|
|
102674
102423
|
case 227 /* ConditionalExpression */:
|
|
102675
102424
|
return visitConditionalExpression(node);
|
|
@@ -104597,7 +104346,7 @@ function transformModule(context) {
|
|
|
104597
104346
|
if (shouldEmitUnderscoreUnderscoreESModule()) {
|
|
104598
104347
|
append(statements, createUnderscoreUnderscoreESModule());
|
|
104599
104348
|
}
|
|
104600
|
-
if (
|
|
104349
|
+
if (some(currentModuleInfo.exportedNames)) {
|
|
104601
104350
|
const chunkSize = 50;
|
|
104602
104351
|
for (let i = 0; i < currentModuleInfo.exportedNames.length; i += chunkSize) {
|
|
104603
104352
|
append(
|
|
@@ -104612,6 +104361,11 @@ function transformModule(context) {
|
|
|
104612
104361
|
);
|
|
104613
104362
|
}
|
|
104614
104363
|
}
|
|
104364
|
+
if (some(currentModuleInfo.exportedFunctions)) {
|
|
104365
|
+
for (const f of currentModuleInfo.exportedFunctions) {
|
|
104366
|
+
appendExportsOfHoistedDeclaration(statements, f);
|
|
104367
|
+
}
|
|
104368
|
+
}
|
|
104615
104369
|
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
|
|
104616
104370
|
addRange(statements, visitNodes2(node.statements, topLevelVisitor, isStatement, statementOffset));
|
|
104617
104371
|
addExportEqualsIfNeeded(
|
|
@@ -104924,9 +104678,14 @@ function transformModule(context) {
|
|
|
104924
104678
|
if (shouldEmitUnderscoreUnderscoreESModule()) {
|
|
104925
104679
|
append(statements, createUnderscoreUnderscoreESModule());
|
|
104926
104680
|
}
|
|
104927
|
-
if (
|
|
104681
|
+
if (some(currentModuleInfo.exportedNames)) {
|
|
104928
104682
|
append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
|
|
104929
104683
|
}
|
|
104684
|
+
if (some(currentModuleInfo.exportedFunctions)) {
|
|
104685
|
+
for (const f of currentModuleInfo.exportedFunctions) {
|
|
104686
|
+
appendExportsOfHoistedDeclaration(statements, f);
|
|
104687
|
+
}
|
|
104688
|
+
}
|
|
104930
104689
|
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, isStatement));
|
|
104931
104690
|
if (moduleKind === 2 /* AMD */) {
|
|
104932
104691
|
addRange(statements, mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport));
|
|
@@ -105049,7 +104808,7 @@ function transformModule(context) {
|
|
|
105049
104808
|
return visitExpressionStatement(node);
|
|
105050
104809
|
case 217 /* ParenthesizedExpression */:
|
|
105051
104810
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
105052
|
-
case
|
|
104811
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
105053
104812
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
105054
104813
|
case 213 /* CallExpression */:
|
|
105055
104814
|
if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
|
|
@@ -105897,7 +105656,6 @@ function transformModule(context) {
|
|
|
105897
105656
|
} else {
|
|
105898
105657
|
statements = append(statements, visitEachChild(node, visitor, context));
|
|
105899
105658
|
}
|
|
105900
|
-
statements = appendExportsOfHoistedDeclaration(statements, node);
|
|
105901
105659
|
return singleOrMany(statements);
|
|
105902
105660
|
}
|
|
105903
105661
|
function visitClassDeclaration(node) {
|
|
@@ -106640,7 +106398,7 @@ function transformSystemModule(context) {
|
|
|
106640
106398
|
if (!moduleInfo.hasExportStarsToExportValues) {
|
|
106641
106399
|
return;
|
|
106642
106400
|
}
|
|
106643
|
-
if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) {
|
|
106401
|
+
if (!some(moduleInfo.exportedNames) && !some(moduleInfo.exportedFunctions) && moduleInfo.exportSpecifiers.size === 0) {
|
|
106644
106402
|
let hasExportDeclarationWithExportClause = false;
|
|
106645
106403
|
for (const externalImport of moduleInfo.externalImports) {
|
|
106646
106404
|
if (externalImport.kind === 278 /* ExportDeclaration */ && externalImport.exportClause) {
|
|
@@ -106671,6 +106429,20 @@ function transformSystemModule(context) {
|
|
|
106671
106429
|
);
|
|
106672
106430
|
}
|
|
106673
106431
|
}
|
|
106432
|
+
if (moduleInfo.exportedFunctions) {
|
|
106433
|
+
for (const f of moduleInfo.exportedFunctions) {
|
|
106434
|
+
if (hasSyntacticModifier(f, 2048 /* Default */)) {
|
|
106435
|
+
continue;
|
|
106436
|
+
}
|
|
106437
|
+
Debug.assert(!!f.name);
|
|
106438
|
+
exportedNames.push(
|
|
106439
|
+
factory2.createPropertyAssignment(
|
|
106440
|
+
factory2.createStringLiteralFromNode(f.name),
|
|
106441
|
+
factory2.createTrue()
|
|
106442
|
+
)
|
|
106443
|
+
);
|
|
106444
|
+
}
|
|
106445
|
+
}
|
|
106674
106446
|
const exportedNamesStorageRef = factory2.createUniqueName("exportedNames");
|
|
106675
106447
|
statements.push(
|
|
106676
106448
|
factory2.createVariableStatement(
|
|
@@ -107429,7 +107201,7 @@ function transformSystemModule(context) {
|
|
|
107429
107201
|
return visitExpressionStatement(node);
|
|
107430
107202
|
case 217 /* ParenthesizedExpression */:
|
|
107431
107203
|
return visitParenthesizedExpression(node, valueIsDiscarded);
|
|
107432
|
-
case
|
|
107204
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
107433
107205
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
107434
107206
|
case 226 /* BinaryExpression */:
|
|
107435
107207
|
if (isDestructuringAssignment(node)) {
|
|
@@ -109537,6 +109309,8 @@ function transformDeclarations(context) {
|
|
|
109537
109309
|
}
|
|
109538
109310
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
109539
109311
|
return;
|
|
109312
|
+
if (isJSDocImportTag(input))
|
|
109313
|
+
return;
|
|
109540
109314
|
if (isFunctionLike(input) && resolver.isImplementationOfOverload(input))
|
|
109541
109315
|
return;
|
|
109542
109316
|
let previousEnclosingDeclaration;
|
|
@@ -110184,7 +109958,7 @@ function noEmitNotification(hint, node, callback) {
|
|
|
110184
109958
|
}
|
|
110185
109959
|
function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
|
|
110186
109960
|
var _a, _b;
|
|
110187
|
-
const enabledSyntaxKindFeatures = new Array(
|
|
109961
|
+
const enabledSyntaxKindFeatures = new Array(357 /* Count */);
|
|
110188
109962
|
let lexicalEnvironmentVariableDeclarations;
|
|
110189
109963
|
let lexicalEnvironmentFunctionDeclarations;
|
|
110190
109964
|
let lexicalEnvironmentStatements;
|
|
@@ -111757,7 +111531,9 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111757
111531
|
return emitJSDocTypedefTag(node);
|
|
111758
111532
|
case 347 /* JSDocSeeTag */:
|
|
111759
111533
|
return emitJSDocSeeTag(node);
|
|
111760
|
-
case
|
|
111534
|
+
case 351 /* JSDocImportTag */:
|
|
111535
|
+
return emitJSDocImportTag(node);
|
|
111536
|
+
case 353 /* NotEmittedStatement */:
|
|
111761
111537
|
return;
|
|
111762
111538
|
}
|
|
111763
111539
|
if (isExpression(node)) {
|
|
@@ -111858,15 +111634,15 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111858
111634
|
return emitJsxSelfClosingElement(node);
|
|
111859
111635
|
case 288 /* JsxFragment */:
|
|
111860
111636
|
return emitJsxFragment(node);
|
|
111861
|
-
case
|
|
111637
|
+
case 352 /* SyntaxList */:
|
|
111862
111638
|
return Debug.fail("SyntaxList should not be printed");
|
|
111863
|
-
case
|
|
111639
|
+
case 353 /* NotEmittedStatement */:
|
|
111864
111640
|
return;
|
|
111865
|
-
case
|
|
111641
|
+
case 354 /* PartiallyEmittedExpression */:
|
|
111866
111642
|
return emitPartiallyEmittedExpression(node);
|
|
111867
|
-
case
|
|
111643
|
+
case 355 /* CommaListExpression */:
|
|
111868
111644
|
return emitCommaList(node);
|
|
111869
|
-
case
|
|
111645
|
+
case 356 /* SyntheticReferenceExpression */:
|
|
111870
111646
|
return Debug.fail("SyntheticReferenceExpression should not be printed");
|
|
111871
111647
|
}
|
|
111872
111648
|
}
|
|
@@ -113710,6 +113486,21 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
113710
113486
|
emit(tag.name);
|
|
113711
113487
|
emitJSDocComment(tag.comment);
|
|
113712
113488
|
}
|
|
113489
|
+
function emitJSDocImportTag(tag) {
|
|
113490
|
+
emitJSDocTagName(tag.tagName);
|
|
113491
|
+
writeSpace();
|
|
113492
|
+
if (tag.importClause) {
|
|
113493
|
+
emit(tag.importClause);
|
|
113494
|
+
writeSpace();
|
|
113495
|
+
emitTokenWithComment(161 /* FromKeyword */, tag.importClause.end, writeKeyword, tag);
|
|
113496
|
+
writeSpace();
|
|
113497
|
+
}
|
|
113498
|
+
emitExpression(tag.moduleSpecifier);
|
|
113499
|
+
if (tag.attributes) {
|
|
113500
|
+
emitWithLeadingSpace(tag.attributes);
|
|
113501
|
+
}
|
|
113502
|
+
emitJSDocComment(tag.comment);
|
|
113503
|
+
}
|
|
113713
113504
|
function emitJSDocNameReference(node) {
|
|
113714
113505
|
writeSpace();
|
|
113715
113506
|
writePunctuation("{");
|
|
@@ -115124,7 +114915,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115124
114915
|
emitLeadingComments(
|
|
115125
114916
|
pos,
|
|
115126
114917
|
/*isEmittedNode*/
|
|
115127
|
-
node.kind !==
|
|
114918
|
+
node.kind !== 353 /* NotEmittedStatement */
|
|
115128
114919
|
);
|
|
115129
114920
|
}
|
|
115130
114921
|
if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) {
|
|
@@ -115148,7 +114939,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115148
114939
|
containerPos = savedContainerPos;
|
|
115149
114940
|
containerEnd = savedContainerEnd;
|
|
115150
114941
|
declarationListContainerEnd = savedDeclarationListContainerEnd;
|
|
115151
|
-
if (!skipTrailingComments && node.kind !==
|
|
114942
|
+
if (!skipTrailingComments && node.kind !== 353 /* NotEmittedStatement */) {
|
|
115152
114943
|
emitTrailingComments(end);
|
|
115153
114944
|
}
|
|
115154
114945
|
}
|
|
@@ -115400,7 +115191,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115400
115191
|
const emitFlags = getEmitFlags(node);
|
|
115401
115192
|
const sourceMapRange = getSourceMapRange(node);
|
|
115402
115193
|
const source = sourceMapRange.source || sourceMapSource;
|
|
115403
|
-
if (node.kind !==
|
|
115194
|
+
if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) {
|
|
115404
115195
|
emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos));
|
|
115405
115196
|
}
|
|
115406
115197
|
if (emitFlags & 128 /* NoNestedSourceMaps */) {
|
|
@@ -115413,7 +115204,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
115413
115204
|
if (emitFlags & 128 /* NoNestedSourceMaps */) {
|
|
115414
115205
|
sourceMapsDisabled = false;
|
|
115415
115206
|
}
|
|
115416
|
-
if (node.kind !==
|
|
115207
|
+
if (node.kind !== 353 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) {
|
|
115417
115208
|
emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end);
|
|
115418
115209
|
}
|
|
115419
115210
|
}
|
|
@@ -118295,7 +118086,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118295
118086
|
);
|
|
118296
118087
|
}
|
|
118297
118088
|
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
118298
|
-
|
|
118089
|
+
collectDynamicImportOrRequireOrJsDocImportCalls(file);
|
|
118299
118090
|
}
|
|
118300
118091
|
file.imports = imports || emptyArray;
|
|
118301
118092
|
file.moduleAugmentations = moduleAugmentations || emptyArray;
|
|
@@ -118339,7 +118130,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118339
118130
|
}
|
|
118340
118131
|
}
|
|
118341
118132
|
}
|
|
118342
|
-
function
|
|
118133
|
+
function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
|
|
118343
118134
|
const r = /import|require/g;
|
|
118344
118135
|
while (r.exec(file2.text) !== null) {
|
|
118345
118136
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
@@ -118368,6 +118159,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118368
118159
|
false
|
|
118369
118160
|
);
|
|
118370
118161
|
imports = append(imports, node.argument.literal);
|
|
118162
|
+
} else if (isJavaScriptFile && isJSDocImportTag(node)) {
|
|
118163
|
+
const moduleNameExpr = getExternalModuleName(node);
|
|
118164
|
+
if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
|
|
118165
|
+
setParentRecursive(
|
|
118166
|
+
node,
|
|
118167
|
+
/*incremental*/
|
|
118168
|
+
false
|
|
118169
|
+
);
|
|
118170
|
+
imports = append(imports, moduleNameExpr);
|
|
118171
|
+
}
|
|
118371
118172
|
}
|
|
118372
118173
|
}
|
|
118373
118174
|
}
|