typescript 5.4.0-dev.20240110 → 5.4.0-dev.20240112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.esnext.collection.d.ts +29 -0
- package/lib/lib.esnext.d.ts +2 -0
- package/lib/lib.esnext.object.d.ts +29 -0
- package/lib/tsc.js +173 -63
- package/lib/tsserver.js +259 -72
- package/lib/typescript.d.ts +6 -2
- package/lib/typescript.js +259 -72
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -898,6 +898,7 @@ __export(server_exports, {
|
|
|
898
898
|
getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
|
|
899
899
|
getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
|
|
900
900
|
getNameForExportedSymbol: () => getNameForExportedSymbol,
|
|
901
|
+
getNameFromImportAttribute: () => getNameFromImportAttribute,
|
|
901
902
|
getNameFromIndexInfo: () => getNameFromIndexInfo,
|
|
902
903
|
getNameFromPropertyName: () => getNameFromPropertyName,
|
|
903
904
|
getNameOfAccessExpression: () => getNameOfAccessExpression,
|
|
@@ -2340,7 +2341,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2341
|
|
|
2341
2342
|
// src/compiler/corePublic.ts
|
|
2342
2343
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2344
|
+
var version = `${versionMajorMinor}.0-dev.20240112`;
|
|
2344
2345
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2346
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2347
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6599,6 +6600,7 @@ var InternalSymbolName = /* @__PURE__ */ ((InternalSymbolName2) => {
|
|
|
6599
6600
|
InternalSymbolName2["Default"] = "default";
|
|
6600
6601
|
InternalSymbolName2["This"] = "this";
|
|
6601
6602
|
InternalSymbolName2["InstantiationExpression"] = "__instantiationExpression";
|
|
6603
|
+
InternalSymbolName2["ImportAttributes"] = "__importAttributes";
|
|
6602
6604
|
return InternalSymbolName2;
|
|
6603
6605
|
})(InternalSymbolName || {});
|
|
6604
6606
|
var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags2) => {
|
|
@@ -8446,6 +8448,7 @@ var sys = (() => {
|
|
|
8446
8448
|
resolvePath: (path) => _path.resolve(path),
|
|
8447
8449
|
fileExists,
|
|
8448
8450
|
directoryExists,
|
|
8451
|
+
getAccessibleFileSystemEntries,
|
|
8449
8452
|
createDirectory(directoryName) {
|
|
8450
8453
|
if (!nodeSystem.directoryExists(directoryName)) {
|
|
8451
8454
|
try {
|
|
@@ -15130,6 +15133,45 @@ function isRestParameter(node) {
|
|
|
15130
15133
|
const type = isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type;
|
|
15131
15134
|
return node.dotDotDotToken !== void 0 || !!type && type.kind === 325 /* JSDocVariadicType */;
|
|
15132
15135
|
}
|
|
15136
|
+
function hasInternalAnnotation(range, sourceFile) {
|
|
15137
|
+
const comment = sourceFile.text.substring(range.pos, range.end);
|
|
15138
|
+
return comment.includes("@internal");
|
|
15139
|
+
}
|
|
15140
|
+
function isInternalDeclaration(node, sourceFile) {
|
|
15141
|
+
sourceFile ?? (sourceFile = getSourceFileOfNode(node));
|
|
15142
|
+
const parseTreeNode = getParseTreeNode(node);
|
|
15143
|
+
if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
|
|
15144
|
+
const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
|
15145
|
+
const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
|
|
15146
|
+
const text = sourceFile.text;
|
|
15147
|
+
const commentRanges = previousSibling ? concatenate(
|
|
15148
|
+
// to handle
|
|
15149
|
+
// ... parameters, /** @internal */
|
|
15150
|
+
// public param: string
|
|
15151
|
+
getTrailingCommentRanges(text, skipTrivia(
|
|
15152
|
+
text,
|
|
15153
|
+
previousSibling.end + 1,
|
|
15154
|
+
/*stopAfterLineBreak*/
|
|
15155
|
+
false,
|
|
15156
|
+
/*stopAtComments*/
|
|
15157
|
+
true
|
|
15158
|
+
)),
|
|
15159
|
+
getLeadingCommentRanges(text, node.pos)
|
|
15160
|
+
) : getTrailingCommentRanges(text, skipTrivia(
|
|
15161
|
+
text,
|
|
15162
|
+
node.pos,
|
|
15163
|
+
/*stopAfterLineBreak*/
|
|
15164
|
+
false,
|
|
15165
|
+
/*stopAtComments*/
|
|
15166
|
+
true
|
|
15167
|
+
));
|
|
15168
|
+
return some(commentRanges) && hasInternalAnnotation(last(commentRanges), sourceFile);
|
|
15169
|
+
}
|
|
15170
|
+
const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, sourceFile);
|
|
15171
|
+
return !!forEach(leadingCommentRanges, (range) => {
|
|
15172
|
+
return hasInternalAnnotation(range, sourceFile);
|
|
15173
|
+
});
|
|
15174
|
+
}
|
|
15133
15175
|
|
|
15134
15176
|
// src/compiler/utilities.ts
|
|
15135
15177
|
var resolvingEmptyArray = [];
|
|
@@ -21902,6 +21944,9 @@ var stringReplace = String.prototype.replace;
|
|
|
21902
21944
|
function replaceFirstStar(s, replacement) {
|
|
21903
21945
|
return stringReplace.call(s, "*", replacement);
|
|
21904
21946
|
}
|
|
21947
|
+
function getNameFromImportAttribute(node) {
|
|
21948
|
+
return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
|
|
21949
|
+
}
|
|
21905
21950
|
|
|
21906
21951
|
// src/compiler/factory/baseNodeFactory.ts
|
|
21907
21952
|
function createBaseNodeFactory() {
|
|
@@ -38503,7 +38548,7 @@ var libEntries = [
|
|
|
38503
38548
|
["es2023.array", "lib.es2023.array.d.ts"],
|
|
38504
38549
|
["es2023.collection", "lib.es2023.collection.d.ts"],
|
|
38505
38550
|
["esnext.array", "lib.es2023.array.d.ts"],
|
|
38506
|
-
["esnext.collection", "lib.
|
|
38551
|
+
["esnext.collection", "lib.esnext.collection.d.ts"],
|
|
38507
38552
|
["esnext.symbol", "lib.es2019.symbol.d.ts"],
|
|
38508
38553
|
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
|
|
38509
38554
|
["esnext.intl", "lib.esnext.intl.d.ts"],
|
|
@@ -38513,6 +38558,7 @@ var libEntries = [
|
|
|
38513
38558
|
["esnext.promise", "lib.esnext.promise.d.ts"],
|
|
38514
38559
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
38515
38560
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
38561
|
+
["esnext.object", "lib.esnext.object.d.ts"],
|
|
38516
38562
|
["decorators", "lib.decorators.d.ts"],
|
|
38517
38563
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
38518
38564
|
];
|
|
@@ -49184,6 +49230,7 @@ function createTypeChecker(host) {
|
|
|
49184
49230
|
var deferredGlobalImportMetaType;
|
|
49185
49231
|
var deferredGlobalImportMetaExpressionType;
|
|
49186
49232
|
var deferredGlobalImportCallOptionsType;
|
|
49233
|
+
var deferredGlobalImportAttributesType;
|
|
49187
49234
|
var deferredGlobalDisposableType;
|
|
49188
49235
|
var deferredGlobalAsyncDisposableType;
|
|
49189
49236
|
var deferredGlobalExtractSymbol;
|
|
@@ -49340,7 +49387,12 @@ function createTypeChecker(host) {
|
|
|
49340
49387
|
}
|
|
49341
49388
|
function markAsSynthetic(node) {
|
|
49342
49389
|
setTextRangePosEnd(node, -1, -1);
|
|
49343
|
-
return visitEachChild(
|
|
49390
|
+
return visitEachChild(
|
|
49391
|
+
node,
|
|
49392
|
+
markAsSynthetic,
|
|
49393
|
+
/*context*/
|
|
49394
|
+
void 0
|
|
49395
|
+
);
|
|
49344
49396
|
}
|
|
49345
49397
|
function getEmitResolver(sourceFile, cancellationToken2) {
|
|
49346
49398
|
getDiagnostics2(sourceFile, cancellationToken2);
|
|
@@ -53382,7 +53434,13 @@ function createTypeChecker(host) {
|
|
|
53382
53434
|
if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) {
|
|
53383
53435
|
return node;
|
|
53384
53436
|
}
|
|
53385
|
-
return setTextRange(factory.cloneNode(visitEachChild(
|
|
53437
|
+
return setTextRange(factory.cloneNode(visitEachChild(
|
|
53438
|
+
node,
|
|
53439
|
+
deepCloneOrReuseNode,
|
|
53440
|
+
/*context*/
|
|
53441
|
+
void 0,
|
|
53442
|
+
deepCloneOrReuseNodes
|
|
53443
|
+
)), node);
|
|
53386
53444
|
}
|
|
53387
53445
|
function deepCloneOrReuseNodes(nodes, visitor, test, start2, count) {
|
|
53388
53446
|
if (nodes && nodes.length === 0) {
|
|
@@ -54104,7 +54162,8 @@ function createTypeChecker(host) {
|
|
|
54104
54162
|
let visited = visitEachChild(
|
|
54105
54163
|
node2,
|
|
54106
54164
|
elideInitializerAndSetEmitFlags,
|
|
54107
|
-
|
|
54165
|
+
/*context*/
|
|
54166
|
+
void 0,
|
|
54108
54167
|
/*nodesVisitor*/
|
|
54109
54168
|
void 0,
|
|
54110
54169
|
elideInitializerAndSetEmitFlags
|
|
@@ -54882,7 +54941,12 @@ function createTypeChecker(host) {
|
|
|
54882
54941
|
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54883
54942
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
54884
54943
|
}
|
|
54885
|
-
return visitEachChild(
|
|
54944
|
+
return visitEachChild(
|
|
54945
|
+
node,
|
|
54946
|
+
visitExistingNodeTreeSymbols,
|
|
54947
|
+
/*context*/
|
|
54948
|
+
void 0
|
|
54949
|
+
);
|
|
54886
54950
|
function getEffectiveDotDotDotForParameter(p) {
|
|
54887
54951
|
return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0);
|
|
54888
54952
|
}
|
|
@@ -54982,7 +55046,7 @@ function createTypeChecker(host) {
|
|
|
54982
55046
|
});
|
|
54983
55047
|
let addingDeclare = !bundled;
|
|
54984
55048
|
const exportEquals = symbolTable.get("export=" /* ExportEquals */);
|
|
54985
|
-
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & 2097152 /* Alias */) {
|
|
55049
|
+
if (exportEquals && symbolTable.size > 1 && exportEquals.flags & (2097152 /* Alias */ | 1536 /* Module */)) {
|
|
54986
55050
|
symbolTable = createSymbolTable();
|
|
54987
55051
|
symbolTable.set("export=" /* ExportEquals */, exportEquals);
|
|
54988
55052
|
}
|
|
@@ -55439,8 +55503,18 @@ function createTypeChecker(host) {
|
|
|
55439
55503
|
);
|
|
55440
55504
|
}
|
|
55441
55505
|
function getNamespaceMembersForSerialization(symbol) {
|
|
55442
|
-
|
|
55443
|
-
|
|
55506
|
+
let exports2 = arrayFrom(getExportsOfSymbol(symbol).values());
|
|
55507
|
+
const merged = getMergedSymbol(symbol);
|
|
55508
|
+
if (merged !== symbol) {
|
|
55509
|
+
const membersSet = new Set(exports2);
|
|
55510
|
+
for (const exported of getExportsOfSymbol(merged).values()) {
|
|
55511
|
+
if (!(getSymbolFlags(resolveSymbol(exported)) & 111551 /* Value */)) {
|
|
55512
|
+
membersSet.add(exported);
|
|
55513
|
+
}
|
|
55514
|
+
}
|
|
55515
|
+
exports2 = arrayFrom(membersSet);
|
|
55516
|
+
}
|
|
55517
|
+
return filter(exports2, (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */));
|
|
55444
55518
|
}
|
|
55445
55519
|
function isTypeOnlyNamespace(symbol) {
|
|
55446
55520
|
return every(getNamespaceMembersForSerialization(symbol), (m) => !(getSymbolFlags(resolveSymbol(m)) & 111551 /* Value */));
|
|
@@ -57421,7 +57495,7 @@ function createTypeChecker(host) {
|
|
|
57421
57495
|
/*reportErrors*/
|
|
57422
57496
|
false
|
|
57423
57497
|
) : unknownType;
|
|
57424
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType)));
|
|
57498
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, reportErrors2 ? 0 /* Normal */ : 1 /* Contextual */, contextualType)));
|
|
57425
57499
|
}
|
|
57426
57500
|
if (isBindingPattern(element.name)) {
|
|
57427
57501
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2);
|
|
@@ -57502,6 +57576,24 @@ function createTypeChecker(host) {
|
|
|
57502
57576
|
0 /* Normal */
|
|
57503
57577
|
), declaration, reportErrors2);
|
|
57504
57578
|
}
|
|
57579
|
+
function getTypeFromImportAttributes(node) {
|
|
57580
|
+
const links = getNodeLinks(node);
|
|
57581
|
+
if (!links.resolvedType) {
|
|
57582
|
+
const symbol = createSymbol(4096 /* ObjectLiteral */, "__importAttributes" /* ImportAttributes */);
|
|
57583
|
+
const members = createSymbolTable();
|
|
57584
|
+
forEach(node.elements, (attr) => {
|
|
57585
|
+
const member = createSymbol(4 /* Property */, getNameFromImportAttribute(attr));
|
|
57586
|
+
member.parent = symbol;
|
|
57587
|
+
member.links.type = checkImportAttribute(attr);
|
|
57588
|
+
member.links.target = member;
|
|
57589
|
+
members.set(member.escapedName, member);
|
|
57590
|
+
});
|
|
57591
|
+
const type = createAnonymousType(symbol, members, emptyArray, emptyArray, emptyArray);
|
|
57592
|
+
type.objectFlags |= 128 /* ObjectLiteral */ | 262144 /* NonInferrableType */;
|
|
57593
|
+
links.resolvedType = type;
|
|
57594
|
+
}
|
|
57595
|
+
return links.resolvedType;
|
|
57596
|
+
}
|
|
57505
57597
|
function isGlobalSymbolConstructor(node) {
|
|
57506
57598
|
const symbol = getSymbolOfNode(node);
|
|
57507
57599
|
const globalSymbol = getGlobalESSymbolConstructorTypeSymbol(
|
|
@@ -57555,18 +57647,18 @@ function createTypeChecker(host) {
|
|
|
57555
57647
|
}
|
|
57556
57648
|
return false;
|
|
57557
57649
|
}
|
|
57558
|
-
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
57650
|
+
function getTypeOfVariableOrParameterOrProperty(symbol, checkMode) {
|
|
57559
57651
|
const links = getSymbolLinks(symbol);
|
|
57560
57652
|
if (!links.type) {
|
|
57561
|
-
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
57562
|
-
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
57653
|
+
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode);
|
|
57654
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol) && !checkMode) {
|
|
57563
57655
|
links.type = type;
|
|
57564
57656
|
}
|
|
57565
57657
|
return type;
|
|
57566
57658
|
}
|
|
57567
57659
|
return links.type;
|
|
57568
57660
|
}
|
|
57569
|
-
function getTypeOfVariableOrParameterOrPropertyWorker(symbol) {
|
|
57661
|
+
function getTypeOfVariableOrParameterOrPropertyWorker(symbol, checkMode) {
|
|
57570
57662
|
if (symbol.flags & 4194304 /* Prototype */) {
|
|
57571
57663
|
return getTypeOfPrototypeProperty(symbol);
|
|
57572
57664
|
}
|
|
@@ -57604,6 +57696,9 @@ function createTypeChecker(host) {
|
|
|
57604
57696
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
57605
57697
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
57606
57698
|
}
|
|
57699
|
+
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
57700
|
+
return errorType;
|
|
57701
|
+
}
|
|
57607
57702
|
return reportCircularityError(symbol);
|
|
57608
57703
|
}
|
|
57609
57704
|
let type;
|
|
@@ -57641,6 +57736,9 @@ function createTypeChecker(host) {
|
|
|
57641
57736
|
if (symbol.flags & 512 /* ValueModule */ && !(symbol.flags & 67108864 /* Assignment */)) {
|
|
57642
57737
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
57643
57738
|
}
|
|
57739
|
+
if (isBindingElement(declaration) && checkMode === 1 /* Contextual */) {
|
|
57740
|
+
return type;
|
|
57741
|
+
}
|
|
57644
57742
|
return reportCircularityError(symbol);
|
|
57645
57743
|
}
|
|
57646
57744
|
return type;
|
|
@@ -57869,7 +57967,7 @@ function createTypeChecker(host) {
|
|
|
57869
57967
|
}
|
|
57870
57968
|
return getTypeOfSymbol(symbol);
|
|
57871
57969
|
}
|
|
57872
|
-
function getTypeOfSymbol(symbol) {
|
|
57970
|
+
function getTypeOfSymbol(symbol, checkMode) {
|
|
57873
57971
|
const checkFlags = getCheckFlags(symbol);
|
|
57874
57972
|
if (checkFlags & 65536 /* DeferredType */) {
|
|
57875
57973
|
return getTypeOfSymbolWithDeferredType(symbol);
|
|
@@ -57884,7 +57982,7 @@ function createTypeChecker(host) {
|
|
|
57884
57982
|
return getTypeOfReverseMappedSymbol(symbol);
|
|
57885
57983
|
}
|
|
57886
57984
|
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
|
|
57887
|
-
return getTypeOfVariableOrParameterOrProperty(symbol);
|
|
57985
|
+
return getTypeOfVariableOrParameterOrProperty(symbol, checkMode);
|
|
57888
57986
|
}
|
|
57889
57987
|
if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) {
|
|
57890
57988
|
return getTypeOfFuncClassEnumModule(symbol);
|
|
@@ -61500,6 +61598,14 @@ function createTypeChecker(host) {
|
|
|
61500
61598
|
reportErrors2
|
|
61501
61599
|
)) || emptyObjectType;
|
|
61502
61600
|
}
|
|
61601
|
+
function getGlobalImportAttributesType(reportErrors2) {
|
|
61602
|
+
return deferredGlobalImportAttributesType || (deferredGlobalImportAttributesType = getGlobalType(
|
|
61603
|
+
"ImportAttributes",
|
|
61604
|
+
/*arity*/
|
|
61605
|
+
0,
|
|
61606
|
+
reportErrors2
|
|
61607
|
+
)) || emptyObjectType;
|
|
61608
|
+
}
|
|
61503
61609
|
function getGlobalESSymbolConstructorSymbol(reportErrors2) {
|
|
61504
61610
|
return deferredGlobalESSymbolConstructorSymbol || (deferredGlobalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol", reportErrors2));
|
|
61505
61611
|
}
|
|
@@ -72247,9 +72353,9 @@ function createTypeChecker(host) {
|
|
|
72247
72353
|
}
|
|
72248
72354
|
}
|
|
72249
72355
|
}
|
|
72250
|
-
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
72356
|
+
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
72251
72357
|
var _a;
|
|
72252
|
-
const type = getTypeOfSymbol(symbol);
|
|
72358
|
+
const type = getTypeOfSymbol(symbol, checkMode);
|
|
72253
72359
|
const declaration = symbol.valueDeclaration;
|
|
72254
72360
|
if (declaration) {
|
|
72255
72361
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
@@ -72376,7 +72482,7 @@ function createTypeChecker(host) {
|
|
|
72376
72482
|
}
|
|
72377
72483
|
}
|
|
72378
72484
|
checkNestedBlockScopedBinding(node, symbol);
|
|
72379
|
-
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node);
|
|
72485
|
+
let type = getNarrowedTypeOfSymbol(localOrExportSymbol, node, checkMode);
|
|
72380
72486
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
72381
72487
|
if (assignmentKind) {
|
|
72382
72488
|
if (!(localOrExportSymbol.flags & 3 /* Variable */) && !(isInJSFile(node) && localOrExportSymbol.flags & 512 /* ValueModule */)) {
|
|
@@ -73686,6 +73792,8 @@ function createTypeChecker(host) {
|
|
|
73686
73792
|
case 286 /* JsxOpeningElement */:
|
|
73687
73793
|
case 285 /* JsxSelfClosingElement */:
|
|
73688
73794
|
return getContextualJsxElementAttributesType(parent2, contextFlags);
|
|
73795
|
+
case 301 /* ImportAttribute */:
|
|
73796
|
+
return getContextualImportAttributeType(parent2);
|
|
73689
73797
|
}
|
|
73690
73798
|
return void 0;
|
|
73691
73799
|
}
|
|
@@ -73733,6 +73841,12 @@ function createTypeChecker(host) {
|
|
|
73733
73841
|
}
|
|
73734
73842
|
}
|
|
73735
73843
|
}
|
|
73844
|
+
function getContextualImportAttributeType(node) {
|
|
73845
|
+
return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
|
|
73846
|
+
/*reportErrors*/
|
|
73847
|
+
false
|
|
73848
|
+
), getNameFromImportAttribute(node));
|
|
73849
|
+
}
|
|
73736
73850
|
function getContextualJsxElementAttributesType(node, contextFlags) {
|
|
73737
73851
|
if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) {
|
|
73738
73852
|
const index = findContextualNode(
|
|
@@ -85818,6 +85932,13 @@ function createTypeChecker(host) {
|
|
|
85818
85932
|
var _a;
|
|
85819
85933
|
const node = declaration.attributes;
|
|
85820
85934
|
if (node) {
|
|
85935
|
+
const importAttributesType = getGlobalImportAttributesType(
|
|
85936
|
+
/*reportErrors*/
|
|
85937
|
+
true
|
|
85938
|
+
);
|
|
85939
|
+
if (importAttributesType !== emptyObjectType) {
|
|
85940
|
+
checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node);
|
|
85941
|
+
}
|
|
85821
85942
|
const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85822
85943
|
const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
|
|
85823
85944
|
const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
|
|
@@ -85837,6 +85958,9 @@ function createTypeChecker(host) {
|
|
|
85837
85958
|
}
|
|
85838
85959
|
}
|
|
85839
85960
|
}
|
|
85961
|
+
function checkImportAttribute(node) {
|
|
85962
|
+
return getRegularTypeOfLiteralType(checkExpressionCached(node.value));
|
|
85963
|
+
}
|
|
85840
85964
|
function checkImportDeclaration(node) {
|
|
85841
85965
|
if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
85842
85966
|
return;
|
|
@@ -87252,6 +87376,12 @@ function createTypeChecker(host) {
|
|
|
87252
87376
|
if (isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
|
|
87253
87377
|
return checkMetaPropertyKeyword(node.parent);
|
|
87254
87378
|
}
|
|
87379
|
+
if (isImportAttributes(node)) {
|
|
87380
|
+
return getGlobalImportAttributesType(
|
|
87381
|
+
/*reportErrors*/
|
|
87382
|
+
false
|
|
87383
|
+
);
|
|
87384
|
+
}
|
|
87255
87385
|
return errorType;
|
|
87256
87386
|
}
|
|
87257
87387
|
function getTypeOfAssignmentPattern(expr) {
|
|
@@ -90323,7 +90453,7 @@ function visitCommaListElements(elements, visitor, discardVisitor = visitor) {
|
|
|
90323
90453
|
return discarded ? discardVisitor(node) : visitor(node);
|
|
90324
90454
|
}, isExpression);
|
|
90325
90455
|
}
|
|
90326
|
-
function visitEachChild(node, visitor, context, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
|
|
90456
|
+
function visitEachChild(node, visitor, context = nullTransformationContext, nodesVisitor = visitNodes2, tokenVisitor, nodeVisitor = visitNode) {
|
|
90327
90457
|
if (node === void 0) {
|
|
90328
90458
|
return void 0;
|
|
90329
90459
|
}
|
|
@@ -104797,12 +104927,22 @@ function transformES2015(context) {
|
|
|
104797
104927
|
case 172 /* PropertyDeclaration */: {
|
|
104798
104928
|
const named = node;
|
|
104799
104929
|
if (isComputedPropertyName(named.name)) {
|
|
104800
|
-
return factory2.replacePropertyName(named, visitEachChild(
|
|
104930
|
+
return factory2.replacePropertyName(named, visitEachChild(
|
|
104931
|
+
named.name,
|
|
104932
|
+
elideUnusedThisCaptureWorker,
|
|
104933
|
+
/*context*/
|
|
104934
|
+
void 0
|
|
104935
|
+
));
|
|
104801
104936
|
}
|
|
104802
104937
|
return node;
|
|
104803
104938
|
}
|
|
104804
104939
|
}
|
|
104805
|
-
return visitEachChild(
|
|
104940
|
+
return visitEachChild(
|
|
104941
|
+
node,
|
|
104942
|
+
elideUnusedThisCaptureWorker,
|
|
104943
|
+
/*context*/
|
|
104944
|
+
void 0
|
|
104945
|
+
);
|
|
104806
104946
|
}
|
|
104807
104947
|
function simplifyConstructorElideUnusedThisCapture(body, original) {
|
|
104808
104948
|
if (original.transformFlags & 16384 /* ContainsLexicalThis */ || hierarchyFacts & 65536 /* LexicalThis */ || hierarchyFacts & 131072 /* CapturedLexicalThis */) {
|
|
@@ -104838,12 +104978,22 @@ function transformES2015(context) {
|
|
|
104838
104978
|
case 172 /* PropertyDeclaration */: {
|
|
104839
104979
|
const named = node;
|
|
104840
104980
|
if (isComputedPropertyName(named.name)) {
|
|
104841
|
-
return factory2.replacePropertyName(named, visitEachChild(
|
|
104981
|
+
return factory2.replacePropertyName(named, visitEachChild(
|
|
104982
|
+
named.name,
|
|
104983
|
+
injectSuperPresenceCheckWorker,
|
|
104984
|
+
/*context*/
|
|
104985
|
+
void 0
|
|
104986
|
+
));
|
|
104842
104987
|
}
|
|
104843
104988
|
return node;
|
|
104844
104989
|
}
|
|
104845
104990
|
}
|
|
104846
|
-
return visitEachChild(
|
|
104991
|
+
return visitEachChild(
|
|
104992
|
+
node,
|
|
104993
|
+
injectSuperPresenceCheckWorker,
|
|
104994
|
+
/*context*/
|
|
104995
|
+
void 0
|
|
104996
|
+
);
|
|
104847
104997
|
}
|
|
104848
104998
|
function complicateConstructorInjectSuperPresenceCheck(body) {
|
|
104849
104999
|
return factory2.updateBlock(body, visitNodes2(body.statements, injectSuperPresenceCheckWorker, isStatement));
|
|
@@ -113241,44 +113391,6 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
113241
113391
|
);
|
|
113242
113392
|
return result.diagnostics;
|
|
113243
113393
|
}
|
|
113244
|
-
function hasInternalAnnotation(range, currentSourceFile) {
|
|
113245
|
-
const comment = currentSourceFile.text.substring(range.pos, range.end);
|
|
113246
|
-
return comment.includes("@internal");
|
|
113247
|
-
}
|
|
113248
|
-
function isInternalDeclaration(node, currentSourceFile) {
|
|
113249
|
-
const parseTreeNode = getParseTreeNode(node);
|
|
113250
|
-
if (parseTreeNode && parseTreeNode.kind === 169 /* Parameter */) {
|
|
113251
|
-
const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
|
|
113252
|
-
const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0;
|
|
113253
|
-
const text = currentSourceFile.text;
|
|
113254
|
-
const commentRanges = previousSibling ? concatenate(
|
|
113255
|
-
// to handle
|
|
113256
|
-
// ... parameters, /** @internal */
|
|
113257
|
-
// public param: string
|
|
113258
|
-
getTrailingCommentRanges(text, skipTrivia(
|
|
113259
|
-
text,
|
|
113260
|
-
previousSibling.end + 1,
|
|
113261
|
-
/*stopAfterLineBreak*/
|
|
113262
|
-
false,
|
|
113263
|
-
/*stopAtComments*/
|
|
113264
|
-
true
|
|
113265
|
-
)),
|
|
113266
|
-
getLeadingCommentRanges(text, node.pos)
|
|
113267
|
-
) : getTrailingCommentRanges(text, skipTrivia(
|
|
113268
|
-
text,
|
|
113269
|
-
node.pos,
|
|
113270
|
-
/*stopAfterLineBreak*/
|
|
113271
|
-
false,
|
|
113272
|
-
/*stopAtComments*/
|
|
113273
|
-
true
|
|
113274
|
-
));
|
|
113275
|
-
return commentRanges && commentRanges.length && hasInternalAnnotation(last(commentRanges), currentSourceFile);
|
|
113276
|
-
}
|
|
113277
|
-
const leadingCommentRanges = parseTreeNode && getLeadingCommentRangesOfNode(parseTreeNode, currentSourceFile);
|
|
113278
|
-
return !!forEach(leadingCommentRanges, (range) => {
|
|
113279
|
-
return hasInternalAnnotation(range, currentSourceFile);
|
|
113280
|
-
});
|
|
113281
|
-
}
|
|
113282
113394
|
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
113283
113395
|
function transformDeclarations(context) {
|
|
113284
113396
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
@@ -124564,7 +124676,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124564
124676
|
}
|
|
124565
124677
|
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
124566
124678
|
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension);
|
|
124567
|
-
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
124679
|
+
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
|
|
124568
124680
|
const resolvedFileName = resolution.resolvedFileName;
|
|
124569
124681
|
if (isFromNodeModulesSearch) {
|
|
124570
124682
|
currentNodeModulesDepth++;
|
|
@@ -134650,7 +134762,14 @@ function getSynthesizedDeepCloneWorker(node, replaceNode) {
|
|
|
134650
134762
|
true,
|
|
134651
134763
|
replaceNode
|
|
134652
134764
|
) : (ns) => ns && getSynthesizedDeepClones(ns);
|
|
134653
|
-
const visited = visitEachChild(
|
|
134765
|
+
const visited = visitEachChild(
|
|
134766
|
+
node,
|
|
134767
|
+
nodeClone,
|
|
134768
|
+
/*context*/
|
|
134769
|
+
void 0,
|
|
134770
|
+
nodesClone,
|
|
134771
|
+
nodeClone
|
|
134772
|
+
);
|
|
134654
134773
|
if (visited === node) {
|
|
134655
134774
|
const clone2 = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) : isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) : factory.cloneNode(node);
|
|
134656
134775
|
return setTextRange(clone2, node);
|
|
@@ -144435,7 +144554,12 @@ function transformFunctionBody(body, exposedVariableDeclarations, writes, substi
|
|
|
144435
144554
|
const oldIgnoreReturns = ignoreReturns;
|
|
144436
144555
|
ignoreReturns = ignoreReturns || isFunctionLikeDeclaration(node) || isClassLike(node);
|
|
144437
144556
|
const substitution = substitutions.get(getNodeId(node).toString());
|
|
144438
|
-
const result = substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(
|
|
144557
|
+
const result = substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(
|
|
144558
|
+
node,
|
|
144559
|
+
visitor,
|
|
144560
|
+
/*context*/
|
|
144561
|
+
void 0
|
|
144562
|
+
);
|
|
144439
144563
|
ignoreReturns = oldIgnoreReturns;
|
|
144440
144564
|
return result;
|
|
144441
144565
|
}
|
|
@@ -144445,7 +144569,12 @@ function transformConstantInitializer(initializer, substitutions) {
|
|
|
144445
144569
|
return substitutions.size ? visitor(initializer) : initializer;
|
|
144446
144570
|
function visitor(node) {
|
|
144447
144571
|
const substitution = substitutions.get(getNodeId(node).toString());
|
|
144448
|
-
return substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(
|
|
144572
|
+
return substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(
|
|
144573
|
+
node,
|
|
144574
|
+
visitor,
|
|
144575
|
+
/*context*/
|
|
144576
|
+
void 0
|
|
144577
|
+
);
|
|
144449
144578
|
}
|
|
144450
144579
|
}
|
|
144451
144580
|
function getStatementsOrClassElements(scope) {
|
|
@@ -149214,7 +149343,12 @@ function transformJSDocType(node) {
|
|
|
149214
149343
|
case 329 /* JSDocTypeLiteral */:
|
|
149215
149344
|
return transformJSDocTypeLiteral(node);
|
|
149216
149345
|
default:
|
|
149217
|
-
const visited = visitEachChild(
|
|
149346
|
+
const visited = visitEachChild(
|
|
149347
|
+
node,
|
|
149348
|
+
transformJSDocType,
|
|
149349
|
+
/*context*/
|
|
149350
|
+
void 0
|
|
149351
|
+
);
|
|
149218
149352
|
setEmitFlags(visited, 1 /* SingleLine */);
|
|
149219
149353
|
return visited;
|
|
149220
149354
|
}
|
|
@@ -157343,7 +157477,12 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
|
|
|
157343
157477
|
const typeArguments = visitNodes2(node.typeArguments, visit, isTypeNode);
|
|
157344
157478
|
return factory.createTypeReferenceNode(qualifier, typeArguments);
|
|
157345
157479
|
}
|
|
157346
|
-
return visitEachChild(
|
|
157480
|
+
return visitEachChild(
|
|
157481
|
+
node,
|
|
157482
|
+
visit,
|
|
157483
|
+
/*context*/
|
|
157484
|
+
void 0
|
|
157485
|
+
);
|
|
157347
157486
|
}
|
|
157348
157487
|
}
|
|
157349
157488
|
function replaceFirstIdentifierOfEntityName(name, newIdentifier) {
|
|
@@ -160879,7 +161018,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
160879
161018
|
return isIdentifier(e) ? e : isPropertyAccessExpression(e) ? getLeftMostName(e.expression) : void 0;
|
|
160880
161019
|
}
|
|
160881
161020
|
function tryGetGlobalSymbols() {
|
|
160882
|
-
const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
|
|
161021
|
+
const result = tryGetObjectTypeLiteralInTypeArgumentCompletionSymbols() || tryGetObjectLikeCompletionSymbols() || tryGetImportCompletionSymbols() || tryGetImportOrExportClauseCompletionSymbols() || tryGetImportAttributesCompletionSymbols() || tryGetLocalNamedExportCompletionSymbols() || tryGetConstructorCompletion() || tryGetClassLikeCompletionSymbols() || tryGetJsxCompletionSymbols() || (getGlobalCompletions(), 1 /* Success */);
|
|
160883
161022
|
return result === 1 /* Success */;
|
|
160884
161023
|
}
|
|
160885
161024
|
function tryGetConstructorCompletion() {
|
|
@@ -161347,6 +161486,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
161347
161486
|
}
|
|
161348
161487
|
return 1 /* Success */;
|
|
161349
161488
|
}
|
|
161489
|
+
function tryGetImportAttributesCompletionSymbols() {
|
|
161490
|
+
if (contextToken === void 0)
|
|
161491
|
+
return 0 /* Continue */;
|
|
161492
|
+
const importAttributes = contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */ ? tryCast(contextToken.parent, isImportAttributes) : contextToken.kind === 59 /* ColonToken */ ? tryCast(contextToken.parent.parent, isImportAttributes) : void 0;
|
|
161493
|
+
if (importAttributes === void 0)
|
|
161494
|
+
return 0 /* Continue */;
|
|
161495
|
+
const existing = new Set(importAttributes.elements.map(getNameFromImportAttribute));
|
|
161496
|
+
symbols = filter(typeChecker.getTypeAtLocation(importAttributes).getApparentProperties(), (attr) => !existing.has(attr.escapedName));
|
|
161497
|
+
return 1 /* Success */;
|
|
161498
|
+
}
|
|
161350
161499
|
function tryGetLocalNamedExportCompletionSymbols() {
|
|
161351
161500
|
var _a;
|
|
161352
161501
|
const namedExports = contextToken && (contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */) ? tryCast(contextToken.parent, isNamedExports) : void 0;
|
|
@@ -163851,6 +164000,11 @@ function getContextNode(node) {
|
|
|
163851
164000
|
return isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(
|
|
163852
164001
|
findAncestor(node.parent, (node2) => isBinaryExpression(node2) || isForInOrOfStatement(node2))
|
|
163853
164002
|
) : node;
|
|
164003
|
+
case 255 /* SwitchStatement */:
|
|
164004
|
+
return {
|
|
164005
|
+
start: find(node.getChildren(node.getSourceFile()), (node2) => node2.kind === 109 /* SwitchKeyword */),
|
|
164006
|
+
end: node.caseBlock
|
|
164007
|
+
};
|
|
163854
164008
|
default:
|
|
163855
164009
|
return node;
|
|
163856
164010
|
}
|
|
@@ -164151,6 +164305,9 @@ function getTextSpan(node, sourceFile, endNode2) {
|
|
|
164151
164305
|
start2 += 1;
|
|
164152
164306
|
end -= 1;
|
|
164153
164307
|
}
|
|
164308
|
+
if ((endNode2 == null ? void 0 : endNode2.kind) === 269 /* CaseBlock */) {
|
|
164309
|
+
end = endNode2.getFullStart();
|
|
164310
|
+
}
|
|
164154
164311
|
return createTextSpanFromBounds(start2, end);
|
|
164155
164312
|
}
|
|
164156
164313
|
function getTextSpanOfEntry(entry) {
|
|
@@ -165706,9 +165863,20 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
165706
165863
|
void 0
|
|
165707
165864
|
)] : void 0;
|
|
165708
165865
|
}
|
|
165709
|
-
|
|
165710
|
-
|
|
165711
|
-
|
|
165866
|
+
switch (node.kind) {
|
|
165867
|
+
case 107 /* ReturnKeyword */:
|
|
165868
|
+
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
|
165869
|
+
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
|
165870
|
+
case 90 /* DefaultKeyword */:
|
|
165871
|
+
if (!isDefaultClause(node.parent)) {
|
|
165872
|
+
break;
|
|
165873
|
+
}
|
|
165874
|
+
case 84 /* CaseKeyword */:
|
|
165875
|
+
const switchStatement = findAncestor(node.parent, isSwitchStatement);
|
|
165876
|
+
if (switchStatement) {
|
|
165877
|
+
return [createDefinitionInfoFromSwitch(switchStatement, sourceFile)];
|
|
165878
|
+
}
|
|
165879
|
+
break;
|
|
165712
165880
|
}
|
|
165713
165881
|
if (node.kind === 135 /* AwaitKeyword */) {
|
|
165714
165882
|
const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
|
|
@@ -166126,6 +166294,23 @@ function createDefinitionInfoFromName(checker, declaration, symbolKind, symbolNa
|
|
|
166126
166294
|
failedAliasResolution
|
|
166127
166295
|
};
|
|
166128
166296
|
}
|
|
166297
|
+
function createDefinitionInfoFromSwitch(statement, sourceFile) {
|
|
166298
|
+
const keyword = ts_FindAllReferences_exports.getContextNode(statement);
|
|
166299
|
+
const textSpan = createTextSpanFromNode(isContextWithStartAndEndNode(keyword) ? keyword.start : keyword, sourceFile);
|
|
166300
|
+
return {
|
|
166301
|
+
fileName: sourceFile.fileName,
|
|
166302
|
+
textSpan,
|
|
166303
|
+
kind: "keyword" /* keyword */,
|
|
166304
|
+
name: "switch",
|
|
166305
|
+
containerKind: void 0,
|
|
166306
|
+
containerName: "",
|
|
166307
|
+
...ts_FindAllReferences_exports.toContextSpan(textSpan, sourceFile, keyword),
|
|
166308
|
+
isLocal: true,
|
|
166309
|
+
isAmbient: false,
|
|
166310
|
+
unverified: false,
|
|
166311
|
+
failedAliasResolution: void 0
|
|
166312
|
+
};
|
|
166313
|
+
}
|
|
166129
166314
|
function isDefinitionVisible(checker, declaration) {
|
|
166130
166315
|
if (checker.isDeclarationVisible(declaration))
|
|
166131
166316
|
return true;
|
|
@@ -174893,6 +175078,7 @@ __export(ts_exports2, {
|
|
|
174893
175078
|
getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference,
|
|
174894
175079
|
getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost,
|
|
174895
175080
|
getNameForExportedSymbol: () => getNameForExportedSymbol,
|
|
175081
|
+
getNameFromImportAttribute: () => getNameFromImportAttribute,
|
|
174896
175082
|
getNameFromIndexInfo: () => getNameFromIndexInfo,
|
|
174897
175083
|
getNameFromPropertyName: () => getNameFromPropertyName,
|
|
174898
175084
|
getNameOfAccessExpression: () => getNameOfAccessExpression,
|
|
@@ -189693,6 +189879,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189693
189879
|
getModuleSpecifierEndingPreference,
|
|
189694
189880
|
getModuleSpecifierResolverHost,
|
|
189695
189881
|
getNameForExportedSymbol,
|
|
189882
|
+
getNameFromImportAttribute,
|
|
189696
189883
|
getNameFromIndexInfo,
|
|
189697
189884
|
getNameFromPropertyName,
|
|
189698
189885
|
getNameOfAccessExpression,
|