typescript 5.9.0-dev.20250415 → 5.9.0-dev.20250416
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 +694 -116
- package/lib/typescript.d.ts +12 -0
- package/lib/typescript.js +874 -231
- package/package.json +2 -2
package/lib/_tsc.js
CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
18
18
|
|
19
19
|
// src/compiler/corePublic.ts
|
20
20
|
var versionMajorMinor = "5.9";
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20250416`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -20013,6 +20013,82 @@ function getOptionsSyntaxByValue(optionsObject, name, value) {
|
|
20013
20013
|
function forEachOptionsSyntaxByName(optionsObject, name, callback) {
|
20014
20014
|
return forEachPropertyAssignment(optionsObject, name, callback);
|
20015
20015
|
}
|
20016
|
+
function getSynthesizedDeepClone(node, includeTrivia = true) {
|
20017
|
+
const clone = node && getSynthesizedDeepCloneWorker(node);
|
20018
|
+
if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone);
|
20019
|
+
return setParentRecursive(
|
20020
|
+
clone,
|
20021
|
+
/*incremental*/
|
20022
|
+
false
|
20023
|
+
);
|
20024
|
+
}
|
20025
|
+
function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) {
|
20026
|
+
let clone = replaceNode(node);
|
20027
|
+
if (clone) {
|
20028
|
+
setOriginalNode(clone, node);
|
20029
|
+
} else {
|
20030
|
+
clone = getSynthesizedDeepCloneWorker(node, replaceNode);
|
20031
|
+
}
|
20032
|
+
if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone);
|
20033
|
+
return clone;
|
20034
|
+
}
|
20035
|
+
function getSynthesizedDeepCloneWorker(node, replaceNode) {
|
20036
|
+
const nodeClone = replaceNode ? (n) => getSynthesizedDeepCloneWithReplacements(
|
20037
|
+
n,
|
20038
|
+
/*includeTrivia*/
|
20039
|
+
true,
|
20040
|
+
replaceNode
|
20041
|
+
) : getSynthesizedDeepClone;
|
20042
|
+
const nodesClone = replaceNode ? (ns) => ns && getSynthesizedDeepClonesWithReplacements(
|
20043
|
+
ns,
|
20044
|
+
/*includeTrivia*/
|
20045
|
+
true,
|
20046
|
+
replaceNode
|
20047
|
+
) : (ns) => ns && getSynthesizedDeepClones(ns);
|
20048
|
+
const visited = visitEachChild(
|
20049
|
+
node,
|
20050
|
+
nodeClone,
|
20051
|
+
/*context*/
|
20052
|
+
void 0,
|
20053
|
+
nodesClone,
|
20054
|
+
nodeClone
|
20055
|
+
);
|
20056
|
+
if (visited === node) {
|
20057
|
+
const clone = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) : isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) : factory.cloneNode(node);
|
20058
|
+
return setTextRange(clone, node);
|
20059
|
+
}
|
20060
|
+
visited.parent = void 0;
|
20061
|
+
return visited;
|
20062
|
+
}
|
20063
|
+
function getSynthesizedDeepClones(nodes, includeTrivia = true) {
|
20064
|
+
if (nodes) {
|
20065
|
+
const cloned = factory.createNodeArray(nodes.map((n) => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma);
|
20066
|
+
setTextRange(cloned, nodes);
|
20067
|
+
return cloned;
|
20068
|
+
}
|
20069
|
+
return nodes;
|
20070
|
+
}
|
20071
|
+
function getSynthesizedDeepClonesWithReplacements(nodes, includeTrivia, replaceNode) {
|
20072
|
+
return factory.createNodeArray(nodes.map((n) => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma);
|
20073
|
+
}
|
20074
|
+
function suppressLeadingAndTrailingTrivia(node) {
|
20075
|
+
suppressLeadingTrivia(node);
|
20076
|
+
suppressTrailingTrivia(node);
|
20077
|
+
}
|
20078
|
+
function suppressLeadingTrivia(node) {
|
20079
|
+
addEmitFlagsRecursively(node, 1024 /* NoLeadingComments */, getFirstChild);
|
20080
|
+
}
|
20081
|
+
function suppressTrailingTrivia(node) {
|
20082
|
+
addEmitFlagsRecursively(node, 2048 /* NoTrailingComments */, getLastChild);
|
20083
|
+
}
|
20084
|
+
function addEmitFlagsRecursively(node, flag, getChild) {
|
20085
|
+
addEmitFlags(node, flag);
|
20086
|
+
const child = getChild(node);
|
20087
|
+
if (child) addEmitFlagsRecursively(child, flag, getChild);
|
20088
|
+
}
|
20089
|
+
function getFirstChild(node) {
|
20090
|
+
return forEachChild(node, (child) => child);
|
20091
|
+
}
|
20016
20092
|
|
20017
20093
|
// src/compiler/factory/baseNodeFactory.ts
|
20018
20094
|
function createBaseNodeFactory() {
|
@@ -46376,11 +46452,11 @@ function createTypeChecker(host) {
|
|
46376
46452
|
typePredicateToString: (predicate, enclosingDeclaration, flags) => {
|
46377
46453
|
return typePredicateToString(predicate, getParseTreeNode(enclosingDeclaration), flags);
|
46378
46454
|
},
|
46379
|
-
writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
|
46380
|
-
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
|
46455
|
+
writeSignature: (signature, enclosingDeclaration, flags, kind, writer, verbosityLevel, out) => {
|
46456
|
+
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer, verbosityLevel, out);
|
46381
46457
|
},
|
46382
|
-
writeType: (type, enclosingDeclaration, flags, writer) => {
|
46383
|
-
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
|
46458
|
+
writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
|
46459
|
+
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
|
46384
46460
|
},
|
46385
46461
|
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
46386
46462
|
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
@@ -46614,7 +46690,8 @@ function createTypeChecker(host) {
|
|
46614
46690
|
isTypeParameterPossiblyReferenced,
|
46615
46691
|
typeHasCallOrConstructSignatures,
|
46616
46692
|
getSymbolFlags,
|
46617
|
-
getTypeArgumentsForResolvedSignature
|
46693
|
+
getTypeArgumentsForResolvedSignature,
|
46694
|
+
isLibType
|
46618
46695
|
};
|
46619
46696
|
function getTypeArgumentsForResolvedSignature(signature) {
|
46620
46697
|
if (signature.mapper === void 0) return void 0;
|
@@ -50291,7 +50368,7 @@ function createTypeChecker(host) {
|
|
50291
50368
|
return writer2;
|
50292
50369
|
}
|
50293
50370
|
}
|
50294
|
-
function signatureToString(signature, enclosingDeclaration, flags = 0 /* None */, kind, writer) {
|
50371
|
+
function signatureToString(signature, enclosingDeclaration, flags = 0 /* None */, kind, writer, verbosityLevel, out) {
|
50295
50372
|
return writer ? signatureToStringWorker(writer).getText() : usingSingleLineStringWriter(signatureToStringWorker);
|
50296
50373
|
function signatureToStringWorker(writer2) {
|
50297
50374
|
let sigOutput;
|
@@ -50300,7 +50377,18 @@ function createTypeChecker(host) {
|
|
50300
50377
|
} else {
|
50301
50378
|
sigOutput = kind === 1 /* Construct */ ? 180 /* ConstructSignature */ : 179 /* CallSignature */;
|
50302
50379
|
}
|
50303
|
-
const sig = nodeBuilder.signatureToSignatureDeclaration(
|
50380
|
+
const sig = nodeBuilder.signatureToSignatureDeclaration(
|
50381
|
+
signature,
|
50382
|
+
sigOutput,
|
50383
|
+
enclosingDeclaration,
|
50384
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */,
|
50385
|
+
/*internalFlags*/
|
50386
|
+
void 0,
|
50387
|
+
/*tracker*/
|
50388
|
+
void 0,
|
50389
|
+
verbosityLevel,
|
50390
|
+
out
|
50391
|
+
);
|
50304
50392
|
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
|
50305
50393
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
50306
50394
|
printer.writeNode(
|
@@ -50313,14 +50401,18 @@ function createTypeChecker(host) {
|
|
50313
50401
|
return writer2;
|
50314
50402
|
}
|
50315
50403
|
}
|
50316
|
-
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
50404
|
+
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), verbosityLevel, out) {
|
50317
50405
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
50318
50406
|
const typeNode = nodeBuilder.typeToTypeNode(
|
50319
50407
|
type,
|
50320
50408
|
enclosingDeclaration,
|
50321
|
-
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0
|
50409
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
|
50322
50410
|
/*internalFlags*/
|
50323
|
-
void 0
|
50411
|
+
void 0,
|
50412
|
+
/*tracker*/
|
50413
|
+
void 0,
|
50414
|
+
verbosityLevel,
|
50415
|
+
out
|
50324
50416
|
);
|
50325
50417
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
50326
50418
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
@@ -50551,31 +50643,120 @@ function createTypeChecker(host) {
|
|
50551
50643
|
};
|
50552
50644
|
return {
|
50553
50645
|
syntacticBuilderResolver,
|
50554
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
50555
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50556
|
-
|
50557
|
-
|
50558
|
-
|
50559
|
-
|
50560
|
-
|
50561
|
-
|
50562
|
-
|
50563
|
-
|
50564
|
-
)
|
50565
|
-
|
50566
|
-
|
50567
|
-
|
50568
|
-
|
50569
|
-
|
50570
|
-
|
50571
|
-
|
50572
|
-
)
|
50573
|
-
|
50574
|
-
|
50575
|
-
|
50576
|
-
|
50577
|
-
|
50578
|
-
|
50646
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out),
|
50647
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50648
|
+
enclosingDeclaration,
|
50649
|
+
flags,
|
50650
|
+
internalFlags,
|
50651
|
+
tracker,
|
50652
|
+
/*verbosityLevel*/
|
50653
|
+
void 0,
|
50654
|
+
(context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)
|
50655
|
+
),
|
50656
|
+
serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50657
|
+
enclosingDeclaration,
|
50658
|
+
flags,
|
50659
|
+
internalFlags,
|
50660
|
+
tracker,
|
50661
|
+
/*verbosityLevel*/
|
50662
|
+
void 0,
|
50663
|
+
(context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)
|
50664
|
+
),
|
50665
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50666
|
+
enclosingDeclaration,
|
50667
|
+
flags,
|
50668
|
+
internalFlags,
|
50669
|
+
tracker,
|
50670
|
+
/*verbosityLevel*/
|
50671
|
+
void 0,
|
50672
|
+
(context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
|
50673
|
+
),
|
50674
|
+
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50675
|
+
enclosingDeclaration,
|
50676
|
+
flags,
|
50677
|
+
internalFlags,
|
50678
|
+
tracker,
|
50679
|
+
/*verbosityLevel*/
|
50680
|
+
void 0,
|
50681
|
+
(context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
|
50682
|
+
),
|
50683
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50684
|
+
enclosingDeclaration,
|
50685
|
+
flags,
|
50686
|
+
internalFlags,
|
50687
|
+
tracker,
|
50688
|
+
/*verbosityLevel*/
|
50689
|
+
void 0,
|
50690
|
+
(context) => indexInfoToIndexSignatureDeclarationHelper(
|
50691
|
+
indexInfo,
|
50692
|
+
context,
|
50693
|
+
/*typeNode*/
|
50694
|
+
void 0
|
50695
|
+
)
|
50696
|
+
),
|
50697
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => signatureToSignatureDeclarationHelper(signature, kind, context), out),
|
50698
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50699
|
+
enclosingDeclaration,
|
50700
|
+
flags,
|
50701
|
+
internalFlags,
|
50702
|
+
tracker,
|
50703
|
+
/*verbosityLevel*/
|
50704
|
+
void 0,
|
50705
|
+
(context) => symbolToName(
|
50706
|
+
symbol,
|
50707
|
+
context,
|
50708
|
+
meaning,
|
50709
|
+
/*expectsIdentifier*/
|
50710
|
+
false
|
50711
|
+
)
|
50712
|
+
),
|
50713
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50714
|
+
enclosingDeclaration,
|
50715
|
+
flags,
|
50716
|
+
internalFlags,
|
50717
|
+
tracker,
|
50718
|
+
/*verbosityLevel*/
|
50719
|
+
void 0,
|
50720
|
+
(context) => symbolToExpression(symbol, context, meaning)
|
50721
|
+
),
|
50722
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50723
|
+
enclosingDeclaration,
|
50724
|
+
flags,
|
50725
|
+
internalFlags,
|
50726
|
+
tracker,
|
50727
|
+
/*verbosityLevel*/
|
50728
|
+
void 0,
|
50729
|
+
(context) => typeParametersToTypeParameterDeclarations(symbol, context)
|
50730
|
+
),
|
50731
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50732
|
+
enclosingDeclaration,
|
50733
|
+
flags,
|
50734
|
+
internalFlags,
|
50735
|
+
tracker,
|
50736
|
+
/*verbosityLevel*/
|
50737
|
+
void 0,
|
50738
|
+
(context) => symbolToParameterDeclaration(symbol, context)
|
50739
|
+
),
|
50740
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context), out),
|
50741
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50742
|
+
enclosingDeclaration,
|
50743
|
+
flags,
|
50744
|
+
internalFlags,
|
50745
|
+
tracker,
|
50746
|
+
/*verbosityLevel*/
|
50747
|
+
void 0,
|
50748
|
+
(context) => symbolTableToDeclarationStatements(symbolTable, context)
|
50749
|
+
),
|
50750
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext(
|
50751
|
+
enclosingDeclaration,
|
50752
|
+
flags,
|
50753
|
+
internalFlags,
|
50754
|
+
tracker,
|
50755
|
+
/*verbosityLevel*/
|
50756
|
+
void 0,
|
50757
|
+
(context) => symbolToNode(symbol, context, meaning)
|
50758
|
+
),
|
50759
|
+
symbolToDeclarations
|
50579
50760
|
};
|
50580
50761
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
50581
50762
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
@@ -50617,7 +50798,75 @@ function createTypeChecker(host) {
|
|
50617
50798
|
}
|
50618
50799
|
return symbolToExpression(symbol, context, meaning);
|
50619
50800
|
}
|
50620
|
-
function
|
50801
|
+
function symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out) {
|
50802
|
+
const nodes = withContext(
|
50803
|
+
/*enclosingDeclaration*/
|
50804
|
+
void 0,
|
50805
|
+
flags,
|
50806
|
+
/*internalFlags*/
|
50807
|
+
void 0,
|
50808
|
+
/*tracker*/
|
50809
|
+
void 0,
|
50810
|
+
verbosityLevel,
|
50811
|
+
(context) => symbolToDeclarationsWorker(symbol, context),
|
50812
|
+
out
|
50813
|
+
);
|
50814
|
+
return mapDefined(nodes, (node) => {
|
50815
|
+
switch (node.kind) {
|
50816
|
+
case 263 /* ClassDeclaration */:
|
50817
|
+
return simplifyClassDeclaration(node, symbol);
|
50818
|
+
case 266 /* EnumDeclaration */:
|
50819
|
+
return simplifyModifiers(node, isEnumDeclaration, symbol);
|
50820
|
+
case 264 /* InterfaceDeclaration */:
|
50821
|
+
return simplifyInterfaceDeclaration(node, symbol, meaning);
|
50822
|
+
case 267 /* ModuleDeclaration */:
|
50823
|
+
return simplifyModifiers(node, isModuleDeclaration, symbol);
|
50824
|
+
default:
|
50825
|
+
return void 0;
|
50826
|
+
}
|
50827
|
+
});
|
50828
|
+
}
|
50829
|
+
function simplifyClassDeclaration(classDecl, symbol) {
|
50830
|
+
const classDeclarations = filter(symbol.declarations, isClassLike);
|
50831
|
+
const originalClassDecl = classDeclarations && classDeclarations.length > 0 ? classDeclarations[0] : classDecl;
|
50832
|
+
const modifiers = getEffectiveModifierFlags(originalClassDecl) & ~(32 /* Export */ | 128 /* Ambient */);
|
50833
|
+
const isAnonymous = isClassExpression(originalClassDecl);
|
50834
|
+
if (isAnonymous) {
|
50835
|
+
classDecl = factory.updateClassDeclaration(
|
50836
|
+
classDecl,
|
50837
|
+
classDecl.modifiers,
|
50838
|
+
/*name*/
|
50839
|
+
void 0,
|
50840
|
+
classDecl.typeParameters,
|
50841
|
+
classDecl.heritageClauses,
|
50842
|
+
classDecl.members
|
50843
|
+
);
|
50844
|
+
}
|
50845
|
+
return factory.replaceModifiers(classDecl, modifiers);
|
50846
|
+
}
|
50847
|
+
function simplifyModifiers(newDecl, isDeclKind, symbol) {
|
50848
|
+
const decls = filter(symbol.declarations, isDeclKind);
|
50849
|
+
const declWithModifiers = decls && decls.length > 0 ? decls[0] : newDecl;
|
50850
|
+
const modifiers = getEffectiveModifierFlags(declWithModifiers) & ~(32 /* Export */ | 128 /* Ambient */);
|
50851
|
+
return factory.replaceModifiers(newDecl, modifiers);
|
50852
|
+
}
|
50853
|
+
function simplifyInterfaceDeclaration(interfaceDecl, symbol, meaning) {
|
50854
|
+
if (!(meaning & 64 /* Interface */)) {
|
50855
|
+
return void 0;
|
50856
|
+
}
|
50857
|
+
return simplifyModifiers(interfaceDecl, isInterfaceDeclaration, symbol);
|
50858
|
+
}
|
50859
|
+
function symbolToDeclarationsWorker(symbol, context) {
|
50860
|
+
const type = getDeclaredTypeOfSymbol(symbol);
|
50861
|
+
context.typeStack.push(type.id);
|
50862
|
+
context.typeStack.push(-1);
|
50863
|
+
const table = createSymbolTable([symbol]);
|
50864
|
+
const statements = symbolTableToDeclarationStatements(table, context);
|
50865
|
+
context.typeStack.pop();
|
50866
|
+
context.typeStack.pop();
|
50867
|
+
return statements;
|
50868
|
+
}
|
50869
|
+
function withContext(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, cb, out) {
|
50621
50870
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
50622
50871
|
const context = {
|
50623
50872
|
enclosingDeclaration,
|
@@ -50625,6 +50874,7 @@ function createTypeChecker(host) {
|
|
50625
50874
|
flags: flags || 0 /* None */,
|
50626
50875
|
internalFlags: internalFlags || 0 /* None */,
|
50627
50876
|
tracker: void 0,
|
50877
|
+
maxExpansionDepth: verbosityLevel ?? -1,
|
50628
50878
|
encounteredError: false,
|
50629
50879
|
suppressReportInferenceFallback: false,
|
50630
50880
|
reportedDiagnostic: false,
|
@@ -50646,13 +50896,23 @@ function createTypeChecker(host) {
|
|
50646
50896
|
typeParameterNamesByText: void 0,
|
50647
50897
|
typeParameterNamesByTextNextNameCount: void 0,
|
50648
50898
|
enclosingSymbolTypes: /* @__PURE__ */ new Map(),
|
50649
|
-
mapper: void 0
|
50899
|
+
mapper: void 0,
|
50900
|
+
depth: 0,
|
50901
|
+
typeStack: [],
|
50902
|
+
out: {
|
50903
|
+
canIncreaseExpansionDepth: false,
|
50904
|
+
truncated: false
|
50905
|
+
}
|
50650
50906
|
};
|
50651
50907
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
50652
50908
|
const resultingNode = cb(context);
|
50653
50909
|
if (context.truncating && context.flags & 1 /* NoTruncation */) {
|
50654
50910
|
context.tracker.reportTruncationError();
|
50655
50911
|
}
|
50912
|
+
if (out) {
|
50913
|
+
out.canIncreaseExpansionDepth = context.out.canIncreaseExpansionDepth;
|
50914
|
+
out.truncated = context.out.truncated;
|
50915
|
+
}
|
50656
50916
|
return context.encounteredError ? void 0 : resultingNode;
|
50657
50917
|
}
|
50658
50918
|
function addSymbolTypeToContext(context, symbol, type) {
|
@@ -50671,19 +50931,49 @@ function createTypeChecker(host) {
|
|
50671
50931
|
function saveRestoreFlags(context) {
|
50672
50932
|
const flags = context.flags;
|
50673
50933
|
const internalFlags = context.internalFlags;
|
50934
|
+
const depth = context.depth;
|
50674
50935
|
return restore;
|
50675
50936
|
function restore() {
|
50676
50937
|
context.flags = flags;
|
50677
50938
|
context.internalFlags = internalFlags;
|
50939
|
+
context.depth = depth;
|
50678
50940
|
}
|
50679
50941
|
}
|
50942
|
+
function checkTruncationLengthIfExpanding(context) {
|
50943
|
+
return context.maxExpansionDepth >= 0 && checkTruncationLength(context);
|
50944
|
+
}
|
50680
50945
|
function checkTruncationLength(context) {
|
50681
50946
|
if (context.truncating) return context.truncating;
|
50682
50947
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
50683
50948
|
}
|
50949
|
+
function canPossiblyExpandType(type, context) {
|
50950
|
+
for (let i = 0; i < context.typeStack.length - 1; i++) {
|
50951
|
+
if (context.typeStack[i] === type.id) {
|
50952
|
+
return false;
|
50953
|
+
}
|
50954
|
+
}
|
50955
|
+
return context.depth < context.maxExpansionDepth || context.depth === context.maxExpansionDepth && !context.out.canIncreaseExpansionDepth;
|
50956
|
+
}
|
50957
|
+
function shouldExpandType(type, context, isAlias = false) {
|
50958
|
+
if (!isAlias && isLibType(type)) {
|
50959
|
+
return false;
|
50960
|
+
}
|
50961
|
+
for (let i = 0; i < context.typeStack.length - 1; i++) {
|
50962
|
+
if (context.typeStack[i] === type.id) {
|
50963
|
+
return false;
|
50964
|
+
}
|
50965
|
+
}
|
50966
|
+
const result = context.depth < context.maxExpansionDepth;
|
50967
|
+
if (!result) {
|
50968
|
+
context.out.canIncreaseExpansionDepth = true;
|
50969
|
+
}
|
50970
|
+
return result;
|
50971
|
+
}
|
50684
50972
|
function typeToTypeNodeHelper(type, context) {
|
50685
50973
|
const restoreFlags = saveRestoreFlags(context);
|
50974
|
+
if (type) context.typeStack.push(type.id);
|
50686
50975
|
const typeNode = typeToTypeNodeWorker(type, context);
|
50976
|
+
if (type) context.typeStack.pop();
|
50687
50977
|
restoreFlags();
|
50688
50978
|
return typeNode;
|
50689
50979
|
}
|
@@ -50694,6 +50984,7 @@ function createTypeChecker(host) {
|
|
50694
50984
|
}
|
50695
50985
|
const inTypeAlias = context.flags & 8388608 /* InTypeAlias */;
|
50696
50986
|
context.flags &= ~8388608 /* InTypeAlias */;
|
50987
|
+
let expandingEnum = false;
|
50697
50988
|
if (!type) {
|
50698
50989
|
if (!(context.flags & 262144 /* AllowEmptyUnionOrIntersection */)) {
|
50699
50990
|
context.encounteredError = true;
|
@@ -50761,7 +51052,11 @@ function createTypeChecker(host) {
|
|
50761
51052
|
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
50762
51053
|
}
|
50763
51054
|
}
|
50764
|
-
|
51055
|
+
if (!shouldExpandType(type, context)) {
|
51056
|
+
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
51057
|
+
} else {
|
51058
|
+
expandingEnum = true;
|
51059
|
+
}
|
50765
51060
|
}
|
50766
51061
|
if (type.flags & 128 /* StringLiteral */) {
|
50767
51062
|
context.approximateLength += type.value.length + 2;
|
@@ -50828,16 +51123,34 @@ function createTypeChecker(host) {
|
|
50828
51123
|
return factory.createThisTypeNode();
|
50829
51124
|
}
|
50830
51125
|
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
50831
|
-
|
50832
|
-
|
50833
|
-
|
50834
|
-
|
51126
|
+
if (!shouldExpandType(
|
51127
|
+
type,
|
51128
|
+
context,
|
51129
|
+
/*isAlias*/
|
51130
|
+
true
|
51131
|
+
)) {
|
51132
|
+
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
51133
|
+
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
|
51134
|
+
if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
|
51135
|
+
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
51136
|
+
}
|
51137
|
+
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
50835
51138
|
}
|
50836
|
-
|
51139
|
+
context.depth += 1;
|
50837
51140
|
}
|
50838
51141
|
const objectFlags = getObjectFlags(type);
|
50839
51142
|
if (objectFlags & 4 /* Reference */) {
|
50840
51143
|
Debug.assert(!!(type.flags & 524288 /* Object */));
|
51144
|
+
if (shouldExpandType(type, context)) {
|
51145
|
+
context.depth += 1;
|
51146
|
+
return createAnonymousTypeNode(
|
51147
|
+
type,
|
51148
|
+
/*forceClassExpansion*/
|
51149
|
+
true,
|
51150
|
+
/*forceExpansion*/
|
51151
|
+
true
|
51152
|
+
);
|
51153
|
+
}
|
50841
51154
|
return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
|
50842
51155
|
}
|
50843
51156
|
if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
|
@@ -50867,6 +51180,16 @@ function createTypeChecker(host) {
|
|
50867
51180
|
void 0
|
50868
51181
|
);
|
50869
51182
|
}
|
51183
|
+
if (objectFlags & 3 /* ClassOrInterface */ && shouldExpandType(type, context)) {
|
51184
|
+
context.depth += 1;
|
51185
|
+
return createAnonymousTypeNode(
|
51186
|
+
type,
|
51187
|
+
/*forceClassExpansion*/
|
51188
|
+
true,
|
51189
|
+
/*forceExpansion*/
|
51190
|
+
true
|
51191
|
+
);
|
51192
|
+
}
|
50870
51193
|
if (type.symbol) {
|
50871
51194
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
50872
51195
|
}
|
@@ -50881,7 +51204,7 @@ function createTypeChecker(host) {
|
|
50881
51204
|
type = type.origin;
|
50882
51205
|
}
|
50883
51206
|
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
|
50884
|
-
const types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
|
51207
|
+
const types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types, expandingEnum) : type.types;
|
50885
51208
|
if (length(types) === 1) {
|
50886
51209
|
return typeToTypeNodeHelper(types[0], context);
|
50887
51210
|
}
|
@@ -51070,7 +51393,7 @@ function createTypeChecker(host) {
|
|
51070
51393
|
}
|
51071
51394
|
return result;
|
51072
51395
|
}
|
51073
|
-
function createAnonymousTypeNode(type2) {
|
51396
|
+
function createAnonymousTypeNode(type2, forceClassExpansion = false, forceExpansion = false) {
|
51074
51397
|
var _a2, _b2;
|
51075
51398
|
const typeId = type2.id;
|
51076
51399
|
const symbol = type2.symbol;
|
@@ -51093,15 +51416,20 @@ function createTypeChecker(host) {
|
|
51093
51416
|
const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
|
51094
51417
|
if (isJSConstructor(symbol.valueDeclaration)) {
|
51095
51418
|
return symbolToTypeNode(symbol, context, isInstanceType);
|
51096
|
-
} else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
51419
|
+
} else if (!forceExpansion && (symbol.flags & 32 /* Class */ && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
51097
51420
|
symbol,
|
51098
51421
|
context.enclosingDeclaration,
|
51099
51422
|
isInstanceType,
|
51100
51423
|
/*shouldComputeAliasesToMakeVisible*/
|
51101
51424
|
false
|
51102
|
-
).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) {
|
51103
|
-
|
51104
|
-
|
51425
|
+
).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol())) {
|
51426
|
+
if (shouldExpandType(type2, context)) {
|
51427
|
+
context.depth += 1;
|
51428
|
+
} else {
|
51429
|
+
return symbolToTypeNode(symbol, context, isInstanceType);
|
51430
|
+
}
|
51431
|
+
}
|
51432
|
+
if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
|
51105
51433
|
const typeAlias = getTypeAliasForTypeLiteral(type2);
|
51106
51434
|
if (typeAlias) {
|
51107
51435
|
return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
|
@@ -51137,7 +51465,7 @@ function createTypeChecker(host) {
|
|
51137
51465
|
if (id && !context.symbolDepth) {
|
51138
51466
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
51139
51467
|
}
|
51140
|
-
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
51468
|
+
const links = context.maxExpansionDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
51141
51469
|
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
51142
51470
|
if (links) {
|
51143
51471
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
@@ -51454,6 +51782,7 @@ function createTypeChecker(host) {
|
|
51454
51782
|
}
|
51455
51783
|
function createTypeNodesFromResolvedType(resolvedType) {
|
51456
51784
|
if (checkTruncationLength(context)) {
|
51785
|
+
context.out.truncated = true;
|
51457
51786
|
if (context.flags & 1 /* NoTruncation */) {
|
51458
51787
|
return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
|
51459
51788
|
}
|
@@ -51467,6 +51796,7 @@ function createTypeChecker(host) {
|
|
51467
51796
|
void 0
|
51468
51797
|
)];
|
51469
51798
|
}
|
51799
|
+
context.typeStack.push(-1);
|
51470
51800
|
const typeElements = [];
|
51471
51801
|
for (const signature of resolvedType.callSignatures) {
|
51472
51802
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 179 /* CallSignature */, context));
|
@@ -51480,10 +51810,14 @@ function createTypeChecker(host) {
|
|
51480
51810
|
}
|
51481
51811
|
const properties = resolvedType.properties;
|
51482
51812
|
if (!properties) {
|
51813
|
+
context.typeStack.pop();
|
51483
51814
|
return typeElements;
|
51484
51815
|
}
|
51485
51816
|
let i = 0;
|
51486
51817
|
for (const propertySymbol of properties) {
|
51818
|
+
if (isExpanding(context) && propertySymbol.flags & 4194304 /* Prototype */) {
|
51819
|
+
continue;
|
51820
|
+
}
|
51487
51821
|
i++;
|
51488
51822
|
if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) {
|
51489
51823
|
if (propertySymbol.flags & 4194304 /* Prototype */) {
|
@@ -51494,6 +51828,7 @@ function createTypeChecker(host) {
|
|
51494
51828
|
}
|
51495
51829
|
}
|
51496
51830
|
if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
|
51831
|
+
context.out.truncated = true;
|
51497
51832
|
if (context.flags & 1 /* NoTruncation */) {
|
51498
51833
|
const typeElement = typeElements.pop();
|
51499
51834
|
typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
|
@@ -51513,6 +51848,7 @@ function createTypeChecker(host) {
|
|
51513
51848
|
}
|
51514
51849
|
addPropertyToElementList(propertySymbol, context, typeElements);
|
51515
51850
|
}
|
51851
|
+
context.typeStack.pop();
|
51516
51852
|
return typeElements.length ? typeElements : void 0;
|
51517
51853
|
}
|
51518
51854
|
}
|
@@ -51661,6 +51997,7 @@ function createTypeChecker(host) {
|
|
51661
51997
|
function mapToTypeNodes(types, context, isBareList) {
|
51662
51998
|
if (some(types)) {
|
51663
51999
|
if (checkTruncationLength(context)) {
|
52000
|
+
context.out.truncated = true;
|
51664
52001
|
if (!isBareList) {
|
51665
52002
|
return [
|
51666
52003
|
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
|
@@ -51688,6 +52025,7 @@ function createTypeChecker(host) {
|
|
51688
52025
|
for (const type of types) {
|
51689
52026
|
i++;
|
51690
52027
|
if (checkTruncationLength(context) && i + 2 < types.length - 1) {
|
52028
|
+
context.out.truncated = true;
|
51691
52029
|
result.push(
|
51692
52030
|
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
|
51693
52031
|
`... ${types.length - i} more ...`,
|
@@ -52085,7 +52423,7 @@ function createTypeChecker(host) {
|
|
52085
52423
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
52086
52424
|
}
|
52087
52425
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
52088
|
-
return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
52426
|
+
return !canPossiblyExpandType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
52089
52427
|
}
|
52090
52428
|
function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
|
52091
52429
|
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
|
@@ -52604,12 +52942,15 @@ function createTypeChecker(host) {
|
|
52604
52942
|
}
|
52605
52943
|
let firstChar = symbolName2.charCodeAt(0);
|
52606
52944
|
if (isSingleOrDoubleQuote(firstChar) && some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
52607
|
-
|
52945
|
+
const specifier = getSpecifierForModuleSymbol(symbol2, context);
|
52946
|
+
context.approximateLength += 2 + specifier.length;
|
52947
|
+
return factory.createStringLiteral(specifier);
|
52608
52948
|
}
|
52609
52949
|
if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) {
|
52610
52950
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
|
52611
52951
|
if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
|
52612
52952
|
identifier.symbol = symbol2;
|
52953
|
+
context.approximateLength += 1 + symbolName2.length;
|
52613
52954
|
return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
|
52614
52955
|
} else {
|
52615
52956
|
if (firstChar === 91 /* openBracket */) {
|
@@ -52618,16 +52959,21 @@ function createTypeChecker(host) {
|
|
52618
52959
|
}
|
52619
52960
|
let expression;
|
52620
52961
|
if (isSingleOrDoubleQuote(firstChar) && !(symbol2.flags & 8 /* EnumMember */)) {
|
52621
|
-
|
52962
|
+
const literalText = stripQuotes(symbolName2).replace(/\\./g, (s) => s.substring(1));
|
52963
|
+
context.approximateLength += literalText.length + 2;
|
52964
|
+
expression = factory.createStringLiteral(literalText, firstChar === 39 /* singleQuote */);
|
52622
52965
|
} else if ("" + +symbolName2 === symbolName2) {
|
52966
|
+
context.approximateLength += symbolName2.length;
|
52623
52967
|
expression = factory.createNumericLiteral(+symbolName2);
|
52624
52968
|
}
|
52625
52969
|
if (!expression) {
|
52626
52970
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
|
52627
52971
|
if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
|
52628
52972
|
identifier.symbol = symbol2;
|
52973
|
+
context.approximateLength += symbolName2.length;
|
52629
52974
|
expression = identifier;
|
52630
52975
|
}
|
52976
|
+
context.approximateLength += 2;
|
52631
52977
|
return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), expression);
|
52632
52978
|
}
|
52633
52979
|
}
|
@@ -52656,6 +53002,10 @@ function createTypeChecker(host) {
|
|
52656
53002
|
), "'")));
|
52657
53003
|
}
|
52658
53004
|
function getPropertyNameNodeForSymbol(symbol, context) {
|
53005
|
+
const hashPrivateName = getClonedHashPrivateName(symbol);
|
53006
|
+
if (hashPrivateName) {
|
53007
|
+
return hashPrivateName;
|
53008
|
+
}
|
52659
53009
|
const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
|
52660
53010
|
const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
|
52661
53011
|
const isMethod = !!(symbol.flags & 8192 /* Method */);
|
@@ -52732,7 +53082,7 @@ function createTypeChecker(host) {
|
|
52732
53082
|
let result;
|
52733
53083
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
52734
53084
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
52735
|
-
if (decl) {
|
53085
|
+
if (!canPossiblyExpandType(type, context) && decl) {
|
52736
53086
|
const restore = addSymbolTypeToContext(context, symbol, type);
|
52737
53087
|
if (isAccessor(decl)) {
|
52738
53088
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
@@ -52771,7 +53121,7 @@ function createTypeChecker(host) {
|
|
52771
53121
|
let returnTypeNode;
|
52772
53122
|
const returnType = getReturnTypeOfSignature(signature);
|
52773
53123
|
if (!(suppressAny && isTypeAny(returnType))) {
|
52774
|
-
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
53124
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration) && !canPossiblyExpandType(returnType, context)) {
|
52775
53125
|
const declarationSymbol = getSymbolOfDeclaration(signature.declaration);
|
52776
53126
|
const restore = addSymbolTypeToContext(context, declarationSymbol, returnType);
|
52777
53127
|
returnTypeNode = syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, declarationSymbol, context);
|
@@ -53182,14 +53532,28 @@ function createTypeChecker(host) {
|
|
53182
53532
|
if (!suppressNewPrivateContext) {
|
53183
53533
|
deferredPrivatesStack.push(/* @__PURE__ */ new Map());
|
53184
53534
|
}
|
53185
|
-
|
53535
|
+
let i = 0;
|
53536
|
+
const symbols = Array.from(symbolTable2.values());
|
53537
|
+
for (const symbol of symbols) {
|
53538
|
+
i++;
|
53539
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < symbolTable2.size - 1) {
|
53540
|
+
context.out.truncated = true;
|
53541
|
+
results.push(createTruncationStatement(`... (${symbolTable2.size - i} more ...)`));
|
53542
|
+
serializeSymbol(
|
53543
|
+
symbols[symbols.length - 1],
|
53544
|
+
/*isPrivate*/
|
53545
|
+
false,
|
53546
|
+
!!propertyAsAlias
|
53547
|
+
);
|
53548
|
+
break;
|
53549
|
+
}
|
53186
53550
|
serializeSymbol(
|
53187
53551
|
symbol,
|
53188
53552
|
/*isPrivate*/
|
53189
53553
|
false,
|
53190
53554
|
!!propertyAsAlias
|
53191
53555
|
);
|
53192
|
-
}
|
53556
|
+
}
|
53193
53557
|
if (!suppressNewPrivateContext) {
|
53194
53558
|
deferredPrivatesStack[deferredPrivatesStack.length - 1].forEach((symbol) => {
|
53195
53559
|
serializeSymbol(
|
@@ -53219,7 +53583,7 @@ function createTypeChecker(host) {
|
|
53219
53583
|
}
|
53220
53584
|
}
|
53221
53585
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
53222
|
-
var _a2, _b, _c, _d, _e, _f;
|
53586
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
53223
53587
|
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
53224
53588
|
const isDefault = escapedSymbolName === "default" /* Default */;
|
53225
53589
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
@@ -53269,6 +53633,7 @@ function createTypeChecker(host) {
|
|
53269
53633
|
const propertyAccessRequire = (_e = symbol.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression);
|
53270
53634
|
if (propertyAccessRequire && isBinaryExpression(propertyAccessRequire.parent) && isIdentifier(propertyAccessRequire.parent.right) && ((_f = type.symbol) == null ? void 0 : _f.valueDeclaration) && isSourceFile(type.symbol.valueDeclaration)) {
|
53271
53635
|
const alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right;
|
53636
|
+
context.approximateLength += 12 + (((_g = alias == null ? void 0 : alias.escapedText) == null ? void 0 : _g.length) ?? 0);
|
53272
53637
|
addResult(
|
53273
53638
|
factory.createExportDeclaration(
|
53274
53639
|
/*modifiers*/
|
@@ -53308,8 +53673,10 @@ function createTypeChecker(host) {
|
|
53308
53673
|
),
|
53309
53674
|
textRange
|
53310
53675
|
);
|
53676
|
+
context.approximateLength += 7 + name.length;
|
53311
53677
|
addResult(statement, name !== localName ? modifierFlags & ~32 /* Export */ : modifierFlags);
|
53312
53678
|
if (name !== localName && !isPrivate) {
|
53679
|
+
context.approximateLength += 16 + name.length + localName.length;
|
53313
53680
|
addResult(
|
53314
53681
|
factory.createExportDeclaration(
|
53315
53682
|
/*modifiers*/
|
@@ -53359,27 +53726,33 @@ function createTypeChecker(host) {
|
|
53359
53726
|
for (const node of symbol.declarations) {
|
53360
53727
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
53361
53728
|
if (!resolvedModule) continue;
|
53729
|
+
const isTypeOnly = node.isTypeOnly;
|
53730
|
+
const specifier = getSpecifierForModuleSymbol(resolvedModule, context);
|
53731
|
+
context.approximateLength += 17 + specifier.length;
|
53362
53732
|
addResult(factory.createExportDeclaration(
|
53363
53733
|
/*modifiers*/
|
53364
53734
|
void 0,
|
53365
|
-
|
53366
|
-
node.isTypeOnly,
|
53735
|
+
isTypeOnly,
|
53367
53736
|
/*exportClause*/
|
53368
53737
|
void 0,
|
53369
|
-
factory.createStringLiteral(
|
53738
|
+
factory.createStringLiteral(specifier)
|
53370
53739
|
), 0 /* None */);
|
53371
53740
|
}
|
53372
53741
|
}
|
53373
53742
|
}
|
53374
53743
|
if (needsPostExportDefault) {
|
53744
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
53745
|
+
context.approximateLength += 16 + internalSymbolName.length;
|
53375
53746
|
addResult(factory.createExportAssignment(
|
53376
53747
|
/*modifiers*/
|
53377
53748
|
void 0,
|
53378
53749
|
/*isExportEquals*/
|
53379
53750
|
false,
|
53380
|
-
factory.createIdentifier(
|
53751
|
+
factory.createIdentifier(internalSymbolName)
|
53381
53752
|
), 0 /* None */);
|
53382
53753
|
} else if (needsExportDeclaration) {
|
53754
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
53755
|
+
context.approximateLength += 22 + symbolName2.length + internalSymbolName.length;
|
53383
53756
|
addResult(
|
53384
53757
|
factory.createExportDeclaration(
|
53385
53758
|
/*modifiers*/
|
@@ -53389,7 +53762,7 @@ function createTypeChecker(host) {
|
|
53389
53762
|
factory.createNamedExports([factory.createExportSpecifier(
|
53390
53763
|
/*isTypeOnly*/
|
53391
53764
|
false,
|
53392
|
-
|
53765
|
+
internalSymbolName,
|
53393
53766
|
symbolName2
|
53394
53767
|
)])
|
53395
53768
|
),
|
@@ -53409,6 +53782,7 @@ function createTypeChecker(host) {
|
|
53409
53782
|
}
|
53410
53783
|
function addResult(node, additionalModifierFlags) {
|
53411
53784
|
if (canHaveModifiers(node)) {
|
53785
|
+
const oldModifierFlags = getEffectiveModifierFlags(node);
|
53412
53786
|
let newModifierFlags = 0 /* None */;
|
53413
53787
|
const enclosingDeclaration2 = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
|
53414
53788
|
if (additionalModifierFlags & 32 /* Export */ && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) {
|
@@ -53421,8 +53795,9 @@ function createTypeChecker(host) {
|
|
53421
53795
|
newModifierFlags |= 2048 /* Default */;
|
53422
53796
|
}
|
53423
53797
|
if (newModifierFlags) {
|
53424
|
-
node = factory.replaceModifiers(node, newModifierFlags |
|
53798
|
+
node = factory.replaceModifiers(node, newModifierFlags | oldModifierFlags);
|
53425
53799
|
}
|
53800
|
+
context.approximateLength += modifiersLength(newModifierFlags | oldModifierFlags);
|
53426
53801
|
}
|
53427
53802
|
results.push(node);
|
53428
53803
|
}
|
@@ -53438,12 +53813,14 @@ function createTypeChecker(host) {
|
|
53438
53813
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
53439
53814
|
context.enclosingDeclaration = jsdocAliasDecl;
|
53440
53815
|
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && syntacticNodeBuilder.tryReuseExistingTypeNode(context, jsdocAliasDecl.typeExpression.type) || typeToTypeNodeHelper(aliasType, context);
|
53816
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
53817
|
+
context.approximateLength += 8 + ((commentText == null ? void 0 : commentText.length) ?? 0) + internalSymbolName.length;
|
53441
53818
|
addResult(
|
53442
53819
|
setSyntheticLeadingComments(
|
53443
53820
|
factory.createTypeAliasDeclaration(
|
53444
53821
|
/*modifiers*/
|
53445
53822
|
void 0,
|
53446
|
-
|
53823
|
+
internalSymbolName,
|
53447
53824
|
typeParamDecls,
|
53448
53825
|
typeNode
|
53449
53826
|
),
|
@@ -53455,12 +53832,19 @@ function createTypeChecker(host) {
|
|
53455
53832
|
context.enclosingDeclaration = oldEnclosingDecl;
|
53456
53833
|
}
|
53457
53834
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
53835
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
53836
|
+
context.approximateLength += 14 + internalSymbolName.length;
|
53458
53837
|
const interfaceType = getDeclaredTypeOfClassOrInterface(symbol);
|
53459
53838
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
53460
53839
|
const typeParamDecls = map(localParams, (p) => typeParameterToDeclaration(p, context));
|
53461
53840
|
const baseTypes = getBaseTypes(interfaceType);
|
53462
53841
|
const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : void 0;
|
53463
|
-
const members =
|
53842
|
+
const members = serializePropertySymbolsForClassOrInterface(
|
53843
|
+
getPropertiesOfType(interfaceType),
|
53844
|
+
/*isClass*/
|
53845
|
+
false,
|
53846
|
+
baseType
|
53847
|
+
);
|
53464
53848
|
const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 179 /* CallSignature */);
|
53465
53849
|
const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */);
|
53466
53850
|
const indexSignatures = serializeIndexSignatures(interfaceType, baseType);
|
@@ -53469,7 +53853,7 @@ function createTypeChecker(host) {
|
|
53469
53853
|
factory.createInterfaceDeclaration(
|
53470
53854
|
/*modifiers*/
|
53471
53855
|
void 0,
|
53472
|
-
|
53856
|
+
internalSymbolName,
|
53473
53857
|
typeParamDecls,
|
53474
53858
|
heritageClauses,
|
53475
53859
|
[...indexSignatures, ...constructSignatures, ...callSignatures, ...members]
|
@@ -53477,6 +53861,57 @@ function createTypeChecker(host) {
|
|
53477
53861
|
modifierFlags
|
53478
53862
|
);
|
53479
53863
|
}
|
53864
|
+
function serializePropertySymbolsForClassOrInterface(props, isClass, baseType, isStatic2) {
|
53865
|
+
const elements = [];
|
53866
|
+
let i = 0;
|
53867
|
+
for (const prop of props) {
|
53868
|
+
i++;
|
53869
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < props.length - 1) {
|
53870
|
+
context.out.truncated = true;
|
53871
|
+
const placeholder = createTruncationProperty(`... ${props.length - i} more ... `, isClass);
|
53872
|
+
elements.push(placeholder);
|
53873
|
+
const result2 = isClass ? serializePropertySymbolForClass(props[props.length - 1], isStatic2, baseType) : serializePropertySymbolForInterface(props[props.length - 1], baseType);
|
53874
|
+
if (isArray(result2)) {
|
53875
|
+
elements.push(...result2);
|
53876
|
+
} else {
|
53877
|
+
elements.push(result2);
|
53878
|
+
}
|
53879
|
+
break;
|
53880
|
+
}
|
53881
|
+
context.approximateLength += 1;
|
53882
|
+
const result = isClass ? serializePropertySymbolForClass(prop, isStatic2, baseType) : serializePropertySymbolForInterface(prop, baseType);
|
53883
|
+
if (isArray(result)) {
|
53884
|
+
elements.push(...result);
|
53885
|
+
} else {
|
53886
|
+
elements.push(result);
|
53887
|
+
}
|
53888
|
+
}
|
53889
|
+
return elements;
|
53890
|
+
}
|
53891
|
+
function createTruncationProperty(dotDotDotText, isClass) {
|
53892
|
+
if (context.flags & 1 /* NoTruncation */) {
|
53893
|
+
return addSyntheticLeadingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, dotDotDotText);
|
53894
|
+
}
|
53895
|
+
return isClass ? factory.createPropertyDeclaration(
|
53896
|
+
/*modifiers*/
|
53897
|
+
void 0,
|
53898
|
+
dotDotDotText,
|
53899
|
+
/*questionOrExclamationToken*/
|
53900
|
+
void 0,
|
53901
|
+
/*type*/
|
53902
|
+
void 0,
|
53903
|
+
/*initializer*/
|
53904
|
+
void 0
|
53905
|
+
) : factory.createPropertySignature(
|
53906
|
+
/*modifiers*/
|
53907
|
+
void 0,
|
53908
|
+
dotDotDotText,
|
53909
|
+
/*questionToken*/
|
53910
|
+
void 0,
|
53911
|
+
/*type*/
|
53912
|
+
void 0
|
53913
|
+
);
|
53914
|
+
}
|
53480
53915
|
function getNamespaceMembersForSerialization(symbol) {
|
53481
53916
|
let exports2 = arrayFrom(getExportsOfSymbol(symbol).values());
|
53482
53917
|
const merged = getMergedSymbol(symbol);
|
@@ -53496,11 +53931,27 @@ function createTypeChecker(host) {
|
|
53496
53931
|
}
|
53497
53932
|
function serializeModule(symbol, symbolName2, modifierFlags) {
|
53498
53933
|
const members = getNamespaceMembersForSerialization(symbol);
|
53499
|
-
const
|
53934
|
+
const expanding = isExpanding(context);
|
53935
|
+
const locationMap = arrayToMultiMap(members, (m) => m.parent && m.parent === symbol || expanding ? "real" : "merged");
|
53500
53936
|
const realMembers = locationMap.get("real") || emptyArray;
|
53501
53937
|
const mergedMembers = locationMap.get("merged") || emptyArray;
|
53502
|
-
if (length(realMembers)) {
|
53503
|
-
|
53938
|
+
if (length(realMembers) || expanding) {
|
53939
|
+
let localName;
|
53940
|
+
if (expanding) {
|
53941
|
+
const oldFlags = context.flags;
|
53942
|
+
context.flags |= 512 /* WriteTypeParametersInQualifiedName */ | 2 /* UseOnlyExternalAliasing */;
|
53943
|
+
localName = symbolToNode(
|
53944
|
+
symbol,
|
53945
|
+
context,
|
53946
|
+
/*meaning*/
|
53947
|
+
-1 /* All */
|
53948
|
+
);
|
53949
|
+
context.flags = oldFlags;
|
53950
|
+
} else {
|
53951
|
+
const localText = getInternalSymbolName(symbol, symbolName2);
|
53952
|
+
localName = factory.createIdentifier(localText);
|
53953
|
+
context.approximateLength += localText.length;
|
53954
|
+
}
|
53504
53955
|
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
53505
53956
|
}
|
53506
53957
|
if (length(mergedMembers)) {
|
@@ -53548,17 +53999,51 @@ function createTypeChecker(host) {
|
|
53548
53999
|
}
|
53549
54000
|
}
|
53550
54001
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
54002
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
54003
|
+
context.approximateLength += 9 + internalSymbolName.length;
|
54004
|
+
const members = [];
|
54005
|
+
const memberProps = filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */));
|
54006
|
+
let i = 0;
|
54007
|
+
for (const p of memberProps) {
|
54008
|
+
i++;
|
54009
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < memberProps.length - 1) {
|
54010
|
+
context.out.truncated = true;
|
54011
|
+
members.push(factory.createEnumMember(` ... ${memberProps.length - i} more ... `));
|
54012
|
+
const last2 = memberProps[memberProps.length - 1];
|
54013
|
+
const initializedValue = last2.declarations && last2.declarations[0] && isEnumMember(last2.declarations[0]) ? getConstantValue2(last2.declarations[0]) : void 0;
|
54014
|
+
const initializer2 = initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue);
|
54015
|
+
const memberName2 = unescapeLeadingUnderscores(last2.escapedName);
|
54016
|
+
const member2 = factory.createEnumMember(
|
54017
|
+
memberName2,
|
54018
|
+
initializer2
|
54019
|
+
);
|
54020
|
+
members.push(member2);
|
54021
|
+
break;
|
54022
|
+
}
|
54023
|
+
const memberDecl = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? p.declarations[0] : void 0;
|
54024
|
+
let initializer;
|
54025
|
+
let initializerLength;
|
54026
|
+
if (isExpanding(context) && memberDecl && memberDecl.initializer) {
|
54027
|
+
initializer = getSynthesizedDeepClone(memberDecl.initializer);
|
54028
|
+
initializerLength = memberDecl.initializer.end - memberDecl.initializer.pos;
|
54029
|
+
} else {
|
54030
|
+
const initializedValue = memberDecl && getConstantValue2(memberDecl);
|
54031
|
+
initializer = initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue);
|
54032
|
+
initializerLength = (initializer == null ? void 0 : initializer.text.length) ?? 0;
|
54033
|
+
}
|
54034
|
+
const memberName = unescapeLeadingUnderscores(p.escapedName);
|
54035
|
+
context.approximateLength += 4 + memberName.length + initializerLength;
|
54036
|
+
const member = factory.createEnumMember(
|
54037
|
+
memberName,
|
54038
|
+
initializer
|
54039
|
+
);
|
54040
|
+
members.push(member);
|
54041
|
+
}
|
53551
54042
|
addResult(
|
53552
54043
|
factory.createEnumDeclaration(
|
53553
54044
|
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 4096 /* Const */ : 0),
|
53554
|
-
|
53555
|
-
|
53556
|
-
const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
|
53557
|
-
return factory.createEnumMember(
|
53558
|
-
unescapeLeadingUnderscores(p.escapedName),
|
53559
|
-
initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue)
|
53560
|
-
);
|
53561
|
-
})
|
54045
|
+
internalSymbolName,
|
54046
|
+
members
|
53562
54047
|
),
|
53563
54048
|
modifierFlags
|
53564
54049
|
);
|
@@ -53566,20 +54051,28 @@ function createTypeChecker(host) {
|
|
53566
54051
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
53567
54052
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
53568
54053
|
for (const sig of signatures) {
|
54054
|
+
context.approximateLength += 1;
|
53569
54055
|
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
53570
54056
|
addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
53571
54057
|
}
|
53572
54058
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
53573
54059
|
const props = filter(getPropertiesOfType(type), isNamespaceMember);
|
54060
|
+
context.approximateLength += localName.length;
|
53574
54061
|
serializeAsNamespaceDeclaration(
|
53575
54062
|
props,
|
53576
|
-
localName,
|
54063
|
+
factory.createIdentifier(localName),
|
53577
54064
|
modifierFlags,
|
53578
54065
|
/*suppressNewPrivateContext*/
|
53579
54066
|
true
|
53580
54067
|
);
|
53581
54068
|
}
|
53582
54069
|
}
|
54070
|
+
function createTruncationStatement(dotDotDotText) {
|
54071
|
+
if (context.flags & 1 /* NoTruncation */) {
|
54072
|
+
return addSyntheticLeadingComment(factory.createEmptyStatement(), 3 /* MultiLineCommentTrivia */, dotDotDotText);
|
54073
|
+
}
|
54074
|
+
return factory.createExpressionStatement(factory.createIdentifier(dotDotDotText));
|
54075
|
+
}
|
53583
54076
|
function getSignatureTextRangeLocation(signature) {
|
53584
54077
|
if (signature.declaration && signature.declaration.parent) {
|
53585
54078
|
if (isBinaryExpression(signature.declaration.parent) && getAssignmentDeclarationKind(signature.declaration.parent) === 5 /* Property */) {
|
@@ -53592,15 +54085,18 @@ function createTypeChecker(host) {
|
|
53592
54085
|
return signature.declaration;
|
53593
54086
|
}
|
53594
54087
|
function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
|
54088
|
+
const nodeFlags = isIdentifier(localName) ? 32 /* Namespace */ : 0 /* None */;
|
54089
|
+
const expanding = isExpanding(context);
|
53595
54090
|
if (length(props)) {
|
53596
|
-
|
54091
|
+
context.approximateLength += 14;
|
54092
|
+
const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) || expanding ? "local" : "remote");
|
53597
54093
|
const localProps = localVsRemoteMap.get("local") || emptyArray;
|
53598
54094
|
let fakespace = parseNodeFactory.createModuleDeclaration(
|
53599
54095
|
/*modifiers*/
|
53600
54096
|
void 0,
|
53601
|
-
|
54097
|
+
localName,
|
53602
54098
|
factory.createModuleBlock([]),
|
53603
|
-
|
54099
|
+
nodeFlags
|
53604
54100
|
);
|
53605
54101
|
setParent(fakespace, enclosingDeclaration);
|
53606
54102
|
fakespace.locals = createSymbolTable(props);
|
@@ -53642,6 +54138,18 @@ function createTypeChecker(host) {
|
|
53642
54138
|
factory.createModuleBlock(exportModifierStripped)
|
53643
54139
|
);
|
53644
54140
|
addResult(fakespace, modifierFlags);
|
54141
|
+
} else if (expanding) {
|
54142
|
+
context.approximateLength += 14;
|
54143
|
+
addResult(
|
54144
|
+
factory.createModuleDeclaration(
|
54145
|
+
/*modifiers*/
|
54146
|
+
void 0,
|
54147
|
+
localName,
|
54148
|
+
factory.createModuleBlock([]),
|
54149
|
+
nodeFlags
|
54150
|
+
),
|
54151
|
+
modifierFlags
|
54152
|
+
);
|
53645
54153
|
}
|
53646
54154
|
}
|
53647
54155
|
function isNamespaceMember(p) {
|
@@ -53684,11 +54192,13 @@ function createTypeChecker(host) {
|
|
53684
54192
|
}
|
53685
54193
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
53686
54194
|
var _a2, _b;
|
54195
|
+
context.approximateLength += 9 + localName.length;
|
53687
54196
|
const originalDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
53688
54197
|
const oldEnclosing = context.enclosingDeclaration;
|
53689
54198
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
53690
54199
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
53691
54200
|
const typeParamDecls = map(localParams, (p) => typeParameterToDeclaration(p, context));
|
54201
|
+
forEach(localParams, (p) => context.approximateLength += symbolName(p.symbol).length);
|
53692
54202
|
const classType = getTypeWithThisArgument(getDeclaredTypeOfClassOrInterface(symbol));
|
53693
54203
|
const baseTypes = getBaseTypes(classType);
|
53694
54204
|
const originalImplements = originalDecl && getEffectiveImplementsTypeNodes(originalDecl);
|
@@ -53696,20 +54206,22 @@ function createTypeChecker(host) {
|
|
53696
54206
|
const staticType = getTypeOfSymbol(symbol);
|
53697
54207
|
const isClass = !!((_b = staticType.symbol) == null ? void 0 : _b.valueDeclaration) && isClassLike(staticType.symbol.valueDeclaration);
|
53698
54208
|
const staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType) : anyType;
|
54209
|
+
context.approximateLength += (length(baseTypes) ? 8 : 0) + (length(implementsExpressions) ? 11 : 0);
|
53699
54210
|
const heritageClauses = [
|
53700
54211
|
...!length(baseTypes) ? [] : [factory.createHeritageClause(96 /* ExtendsKeyword */, map(baseTypes, (b) => serializeBaseType(b, staticBaseType, localName)))],
|
53701
54212
|
...!length(implementsExpressions) ? [] : [factory.createHeritageClause(119 /* ImplementsKeyword */, implementsExpressions)]
|
53702
54213
|
];
|
53703
54214
|
const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
53704
|
-
const publicSymbolProps = filter(symbolProps, (s) =>
|
53705
|
-
|
53706
|
-
|
53707
|
-
|
53708
|
-
|
53709
|
-
|
53710
|
-
|
53711
|
-
|
53712
|
-
|
54215
|
+
const publicSymbolProps = filter(symbolProps, (s) => !isHashPrivate(s));
|
54216
|
+
const hasPrivateIdentifier = some(symbolProps, isHashPrivate);
|
54217
|
+
const privateProperties = hasPrivateIdentifier ? isExpanding(context) ? serializePropertySymbolsForClassOrInterface(
|
54218
|
+
filter(symbolProps, isHashPrivate),
|
54219
|
+
/*isClass*/
|
54220
|
+
true,
|
54221
|
+
baseTypes[0],
|
54222
|
+
/*isStatic*/
|
54223
|
+
false
|
54224
|
+
) : [factory.createPropertyDeclaration(
|
53713
54225
|
/*modifiers*/
|
53714
54226
|
void 0,
|
53715
54227
|
factory.createPrivateIdentifier("#private"),
|
@@ -53720,22 +54232,27 @@ function createTypeChecker(host) {
|
|
53720
54232
|
/*initializer*/
|
53721
54233
|
void 0
|
53722
54234
|
)] : emptyArray;
|
53723
|
-
|
53724
|
-
|
54235
|
+
if (hasPrivateIdentifier && !isExpanding(context)) {
|
54236
|
+
context.approximateLength += 9;
|
54237
|
+
}
|
54238
|
+
const publicProperties = serializePropertySymbolsForClassOrInterface(
|
54239
|
+
publicSymbolProps,
|
54240
|
+
/*isClass*/
|
54241
|
+
true,
|
54242
|
+
baseTypes[0],
|
53725
54243
|
/*isStatic*/
|
53726
|
-
false
|
53727
|
-
|
53728
|
-
|
53729
|
-
const staticMembers = flatMap(
|
54244
|
+
false
|
54245
|
+
);
|
54246
|
+
const staticMembers = serializePropertySymbolsForClassOrInterface(
|
53730
54247
|
filter(getPropertiesOfType(staticType), (p) => !(p.flags & 4194304 /* Prototype */) && p.escapedName !== "prototype" && !isNamespaceMember(p)),
|
53731
|
-
|
53732
|
-
|
53733
|
-
|
53734
|
-
|
53735
|
-
|
53736
|
-
)
|
54248
|
+
/*isClass*/
|
54249
|
+
true,
|
54250
|
+
staticBaseType,
|
54251
|
+
/*isStatic*/
|
54252
|
+
true
|
53737
54253
|
);
|
53738
54254
|
const isNonConstructableClassLikeInJsFile = !isClass && !!symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && !some(getSignaturesOfType(staticType, 1 /* Construct */));
|
54255
|
+
if (isNonConstructableClassLikeInJsFile) context.approximateLength += 21;
|
53739
54256
|
const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration(
|
53740
54257
|
factory.createModifiersFromModifierFlags(2 /* Private */),
|
53741
54258
|
[],
|
@@ -53803,6 +54320,8 @@ function createTypeChecker(host) {
|
|
53803
54320
|
if (((_b = (_a2 = node.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
53804
54321
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
53805
54322
|
const { propertyName } = node;
|
54323
|
+
const propertyNameText = propertyName && isIdentifier(propertyName) ? idText(propertyName) : void 0;
|
54324
|
+
context.approximateLength += 24 + localName.length + specifier2.length + ((propertyNameText == null ? void 0 : propertyNameText.length) ?? 0);
|
53806
54325
|
addResult(
|
53807
54326
|
factory.createImportDeclaration(
|
53808
54327
|
/*modifiers*/
|
@@ -53815,7 +54334,7 @@ function createTypeChecker(host) {
|
|
53815
54334
|
factory.createNamedImports([factory.createImportSpecifier(
|
53816
54335
|
/*isTypeOnly*/
|
53817
54336
|
false,
|
53818
|
-
|
54337
|
+
propertyNameText ? factory.createIdentifier(propertyNameText) : void 0,
|
53819
54338
|
factory.createIdentifier(localName)
|
53820
54339
|
)])
|
53821
54340
|
),
|
@@ -53842,6 +54361,7 @@ function createTypeChecker(host) {
|
|
53842
54361
|
const initializer = node.initializer;
|
53843
54362
|
const uniqueName = factory.createUniqueName(localName);
|
53844
54363
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
54364
|
+
context.approximateLength += 22 + specifier2.length + idText(uniqueName).length;
|
53845
54365
|
addResult(
|
53846
54366
|
factory.createImportEqualsDeclaration(
|
53847
54367
|
/*modifiers*/
|
@@ -53853,6 +54373,7 @@ function createTypeChecker(host) {
|
|
53853
54373
|
),
|
53854
54374
|
0 /* None */
|
53855
54375
|
);
|
54376
|
+
context.approximateLength += 12 + localName.length + idText(uniqueName).length + idText(initializer.name).length;
|
53856
54377
|
addResult(
|
53857
54378
|
factory.createImportEqualsDeclaration(
|
53858
54379
|
/*modifiers*/
|
@@ -53873,6 +54394,7 @@ function createTypeChecker(host) {
|
|
53873
54394
|
break;
|
53874
54395
|
}
|
53875
54396
|
const isLocalImport = !(target.flags & 512 /* ValueModule */) && !isVariableDeclaration(node);
|
54397
|
+
context.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length;
|
53876
54398
|
addResult(
|
53877
54399
|
factory.createImportEqualsDeclaration(
|
53878
54400
|
/*modifiers*/
|
@@ -53899,6 +54421,7 @@ function createTypeChecker(host) {
|
|
53899
54421
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
53900
54422
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
53901
54423
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
54424
|
+
context.approximateLength += 14 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
53902
54425
|
addResult(
|
53903
54426
|
factory.createImportDeclaration(
|
53904
54427
|
/*modifiers*/
|
@@ -53920,6 +54443,7 @@ function createTypeChecker(host) {
|
|
53920
54443
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
53921
54444
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
53922
54445
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
54446
|
+
context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
53923
54447
|
addResult(
|
53924
54448
|
factory.createImportDeclaration(
|
53925
54449
|
/*modifiers*/
|
@@ -53938,6 +54462,7 @@ function createTypeChecker(host) {
|
|
53938
54462
|
break;
|
53939
54463
|
}
|
53940
54464
|
case 280 /* NamespaceExport */:
|
54465
|
+
context.approximateLength += 19 + localName.length + 3;
|
53941
54466
|
addResult(
|
53942
54467
|
factory.createExportDeclaration(
|
53943
54468
|
/*modifiers*/
|
@@ -53954,6 +54479,7 @@ function createTypeChecker(host) {
|
|
53954
54479
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
53955
54480
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
53956
54481
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
54482
|
+
context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
53957
54483
|
addResult(
|
53958
54484
|
factory.createImportDeclaration(
|
53959
54485
|
/*modifiers*/
|
@@ -54009,6 +54535,7 @@ function createTypeChecker(host) {
|
|
54009
54535
|
}
|
54010
54536
|
}
|
54011
54537
|
function serializeExportSpecifier(localName, targetName, specifier) {
|
54538
|
+
context.approximateLength += 16 + localName.length + (localName !== targetName ? targetName.length : 0);
|
54012
54539
|
addResult(
|
54013
54540
|
factory.createExportDeclaration(
|
54014
54541
|
/*modifiers*/
|
@@ -54059,6 +54586,7 @@ function createTypeChecker(host) {
|
|
54059
54586
|
const prevDisableTrackSymbol = context.tracker.disableTrackSymbol;
|
54060
54587
|
context.tracker.disableTrackSymbol = true;
|
54061
54588
|
if (isExportAssignmentCompatibleSymbolName) {
|
54589
|
+
context.approximateLength += 10;
|
54062
54590
|
results.push(factory.createExportAssignment(
|
54063
54591
|
/*modifiers*/
|
54064
54592
|
void 0,
|
@@ -54072,6 +54600,7 @@ function createTypeChecker(host) {
|
|
54072
54600
|
serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target)));
|
54073
54601
|
} else {
|
54074
54602
|
const varName = getUnusedName(name, symbol);
|
54603
|
+
context.approximateLength += varName.length + 10;
|
54075
54604
|
addResult(
|
54076
54605
|
factory.createImportEqualsDeclaration(
|
54077
54606
|
/*modifiers*/
|
@@ -54101,6 +54630,7 @@ function createTypeChecker(host) {
|
|
54101
54630
|
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
54102
54631
|
} else {
|
54103
54632
|
const flags = ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
54633
|
+
context.approximateLength += varName.length + 5;
|
54104
54634
|
const statement = factory.createVariableStatement(
|
54105
54635
|
/*modifiers*/
|
54106
54636
|
void 0,
|
@@ -54125,6 +54655,7 @@ function createTypeChecker(host) {
|
|
54125
54655
|
);
|
54126
54656
|
}
|
54127
54657
|
if (isExportAssignmentCompatibleSymbolName) {
|
54658
|
+
context.approximateLength += varName.length + 10;
|
54128
54659
|
results.push(factory.createExportAssignment(
|
54129
54660
|
/*modifiers*/
|
54130
54661
|
void 0,
|
@@ -54159,7 +54690,7 @@ function createTypeChecker(host) {
|
|
54159
54690
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
54160
54691
|
var _a2, _b, _c, _d, _e, _f;
|
54161
54692
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
54162
|
-
const
|
54693
|
+
const omitType = !!(modifierFlags & 2 /* Private */) && !isExpanding(context);
|
54163
54694
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
54164
54695
|
return [];
|
54165
54696
|
}
|
@@ -54188,6 +54719,7 @@ function createTypeChecker(host) {
|
|
54188
54719
|
Debug.assert(!!setter);
|
54189
54720
|
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
54190
54721
|
const setterDeclaration = (_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor);
|
54722
|
+
context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2);
|
54191
54723
|
result.push(setTextRange2(
|
54192
54724
|
context,
|
54193
54725
|
factory.createSetAccessorDeclaration(
|
@@ -54201,7 +54733,7 @@ function createTypeChecker(host) {
|
|
54201
54733
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
54202
54734
|
/*questionToken*/
|
54203
54735
|
void 0,
|
54204
|
-
|
54736
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, setterDeclaration, getWriteTypeOfSymbol(p), p)
|
54205
54737
|
)],
|
54206
54738
|
/*body*/
|
54207
54739
|
void 0
|
@@ -54210,15 +54742,15 @@ function createTypeChecker(host) {
|
|
54210
54742
|
));
|
54211
54743
|
}
|
54212
54744
|
if (p.flags & 32768 /* GetAccessor */) {
|
54213
|
-
const isPrivate2 = modifierFlags & 2 /* Private */;
|
54214
54745
|
const getterDeclaration = (_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor);
|
54746
|
+
context.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2);
|
54215
54747
|
result.push(setTextRange2(
|
54216
54748
|
context,
|
54217
54749
|
factory.createGetAccessorDeclaration(
|
54218
54750
|
factory.createModifiersFromModifierFlags(flag),
|
54219
54751
|
name,
|
54220
54752
|
[],
|
54221
|
-
|
54753
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, getterDeclaration, getTypeOfSymbol(p), p),
|
54222
54754
|
/*body*/
|
54223
54755
|
void 0
|
54224
54756
|
),
|
@@ -54227,13 +54759,15 @@ function createTypeChecker(host) {
|
|
54227
54759
|
}
|
54228
54760
|
return result;
|
54229
54761
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
54762
|
+
const modifierFlags2 = (isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag;
|
54763
|
+
context.approximateLength += 2 + (omitType ? 0 : 2) + modifiersLength(modifierFlags2);
|
54230
54764
|
return setTextRange2(
|
54231
54765
|
context,
|
54232
54766
|
createProperty2(
|
54233
|
-
factory.createModifiersFromModifierFlags(
|
54767
|
+
factory.createModifiersFromModifierFlags(modifierFlags2),
|
54234
54768
|
name,
|
54235
54769
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
54236
|
-
|
54770
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, (_d = p.declarations) == null ? void 0 : _d.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p),
|
54237
54771
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
54238
54772
|
// interface members can't have initializers, however class members _can_
|
54239
54773
|
/*initializer*/
|
@@ -54245,11 +54779,13 @@ function createTypeChecker(host) {
|
|
54245
54779
|
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
54246
54780
|
const type = getTypeOfSymbol(p);
|
54247
54781
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
54248
|
-
if (
|
54782
|
+
if (omitType) {
|
54783
|
+
const modifierFlags2 = (isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag;
|
54784
|
+
context.approximateLength += 1 + modifiersLength(modifierFlags2);
|
54249
54785
|
return setTextRange2(
|
54250
54786
|
context,
|
54251
54787
|
createProperty2(
|
54252
|
-
factory.createModifiersFromModifierFlags(
|
54788
|
+
factory.createModifiersFromModifierFlags(modifierFlags2),
|
54253
54789
|
name,
|
54254
54790
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
54255
54791
|
/*type*/
|
@@ -54262,6 +54798,7 @@ function createTypeChecker(host) {
|
|
54262
54798
|
}
|
54263
54799
|
const results2 = [];
|
54264
54800
|
for (const sig of signatures) {
|
54801
|
+
context.approximateLength += 1;
|
54265
54802
|
const decl = signatureToSignatureDeclarationHelper(
|
54266
54803
|
sig,
|
54267
54804
|
methodKind,
|
@@ -54280,6 +54817,25 @@ function createTypeChecker(host) {
|
|
54280
54817
|
return Debug.fail(`Unhandled class member kind! ${p.__debugFlags || p.flags}`);
|
54281
54818
|
};
|
54282
54819
|
}
|
54820
|
+
function modifiersLength(flags) {
|
54821
|
+
let result = 0;
|
54822
|
+
if (flags & 32 /* Export */) result += 7;
|
54823
|
+
if (flags & 128 /* Ambient */) result += 8;
|
54824
|
+
if (flags & 2048 /* Default */) result += 8;
|
54825
|
+
if (flags & 4096 /* Const */) result += 6;
|
54826
|
+
if (flags & 1 /* Public */) result += 7;
|
54827
|
+
if (flags & 2 /* Private */) result += 8;
|
54828
|
+
if (flags & 4 /* Protected */) result += 10;
|
54829
|
+
if (flags & 64 /* Abstract */) result += 9;
|
54830
|
+
if (flags & 256 /* Static */) result += 7;
|
54831
|
+
if (flags & 16 /* Override */) result += 9;
|
54832
|
+
if (flags & 8 /* Readonly */) result += 9;
|
54833
|
+
if (flags & 512 /* Accessor */) result += 9;
|
54834
|
+
if (flags & 1024 /* Async */) result += 6;
|
54835
|
+
if (flags & 8192 /* In */) result += 3;
|
54836
|
+
if (flags & 16384 /* Out */) result += 4;
|
54837
|
+
return result;
|
54838
|
+
}
|
54283
54839
|
function serializePropertySymbolForInterface(p, baseType) {
|
54284
54840
|
return serializePropertySymbolForInterfaceWorker(
|
54285
54841
|
p,
|
@@ -54344,6 +54900,7 @@ function createTypeChecker(host) {
|
|
54344
54900
|
}
|
54345
54901
|
const results2 = [];
|
54346
54902
|
for (const sig of signatures) {
|
54903
|
+
context.approximateLength += 1;
|
54347
54904
|
const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
|
54348
54905
|
results2.push(setTextRange2(context, decl, sig.declaration));
|
54349
54906
|
}
|
@@ -54469,6 +55026,23 @@ function createTypeChecker(host) {
|
|
54469
55026
|
return localName;
|
54470
55027
|
}
|
54471
55028
|
}
|
55029
|
+
function isExpanding(context) {
|
55030
|
+
return context.maxExpansionDepth !== -1;
|
55031
|
+
}
|
55032
|
+
function isHashPrivate(s) {
|
55033
|
+
return !!s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name);
|
55034
|
+
}
|
55035
|
+
function getClonedHashPrivateName(s) {
|
55036
|
+
if (s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name)) {
|
55037
|
+
return factory.cloneNode(s.valueDeclaration.name);
|
55038
|
+
}
|
55039
|
+
return void 0;
|
55040
|
+
}
|
55041
|
+
}
|
55042
|
+
function isLibType(type) {
|
55043
|
+
var _a;
|
55044
|
+
const symbol = (getObjectFlags(type) & 4 /* Reference */) !== 0 ? type.target.symbol : type.symbol;
|
55045
|
+
return isTupleType(type) || !!((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.some((decl) => host.isSourceFileDefaultLibrary(getSourceFileOfNode(decl))));
|
54472
55046
|
}
|
54473
55047
|
function typePredicateToString(typePredicate, enclosingDeclaration, flags = 16384 /* UseAliasDefinedOutsideCurrentScope */, writer) {
|
54474
55048
|
return writer ? typePredicateToStringWorker(writer).getText() : usingSingleLineStringWriter(typePredicateToStringWorker);
|
@@ -54487,14 +55061,14 @@ function createTypeChecker(host) {
|
|
54487
55061
|
return writer2;
|
54488
55062
|
}
|
54489
55063
|
}
|
54490
|
-
function formatUnionTypes(types) {
|
55064
|
+
function formatUnionTypes(types, expandingEnum) {
|
54491
55065
|
const result = [];
|
54492
55066
|
let flags = 0;
|
54493
55067
|
for (let i = 0; i < types.length; i++) {
|
54494
55068
|
const t = types[i];
|
54495
55069
|
flags |= t.flags;
|
54496
55070
|
if (!(t.flags & 98304 /* Nullable */)) {
|
54497
|
-
if (t.flags &
|
55071
|
+
if (t.flags & 512 /* BooleanLiteral */ || !expandingEnum && t.flags | 1056 /* EnumLike */) {
|
54498
55072
|
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
54499
55073
|
if (baseType.flags & 1048576 /* Union */) {
|
54500
55074
|
const count = baseType.types.length;
|
@@ -87439,6 +88013,9 @@ function createTypeChecker(host) {
|
|
87439
88013
|
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
87440
88014
|
}
|
87441
88015
|
}
|
88016
|
+
},
|
88017
|
+
symbolToDeclarations: (symbol, meaning, flags, verbosityLevel, out) => {
|
88018
|
+
return nodeBuilder.symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out);
|
87442
88019
|
}
|
87443
88020
|
};
|
87444
88021
|
function isImportRequiredByAugmentation(node) {
|
@@ -115342,7 +115919,8 @@ var notImplementedResolver = {
|
|
115342
115919
|
getDeclarationStatementsForSourceFile: notImplemented,
|
115343
115920
|
isImportRequiredByAugmentation: notImplemented,
|
115344
115921
|
isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
|
115345
|
-
createLateBoundIndexSignatures: notImplemented
|
115922
|
+
createLateBoundIndexSignatures: notImplemented,
|
115923
|
+
symbolToDeclarations: notImplemented
|
115346
115924
|
};
|
115347
115925
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
115348
115926
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|