typescript 5.9.0-dev.20250414 → 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 +695 -117
- package/lib/typescript.d.ts +12 -0
- package/lib/typescript.js +875 -232
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2285
2285
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
2287
2287
|
var versionMajorMinor = "5.9";
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250416`;
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -24109,6 +24109,82 @@ function getOptionsSyntaxByValue(optionsObject, name, value) {
|
|
24109
24109
|
function forEachOptionsSyntaxByName(optionsObject, name, callback) {
|
24110
24110
|
return forEachPropertyAssignment(optionsObject, name, callback);
|
24111
24111
|
}
|
24112
|
+
function getSynthesizedDeepClone(node, includeTrivia = true) {
|
24113
|
+
const clone2 = node && getSynthesizedDeepCloneWorker(node);
|
24114
|
+
if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
|
24115
|
+
return setParentRecursive(
|
24116
|
+
clone2,
|
24117
|
+
/*incremental*/
|
24118
|
+
false
|
24119
|
+
);
|
24120
|
+
}
|
24121
|
+
function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) {
|
24122
|
+
let clone2 = replaceNode(node);
|
24123
|
+
if (clone2) {
|
24124
|
+
setOriginalNode(clone2, node);
|
24125
|
+
} else {
|
24126
|
+
clone2 = getSynthesizedDeepCloneWorker(node, replaceNode);
|
24127
|
+
}
|
24128
|
+
if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
|
24129
|
+
return clone2;
|
24130
|
+
}
|
24131
|
+
function getSynthesizedDeepCloneWorker(node, replaceNode) {
|
24132
|
+
const nodeClone = replaceNode ? (n) => getSynthesizedDeepCloneWithReplacements(
|
24133
|
+
n,
|
24134
|
+
/*includeTrivia*/
|
24135
|
+
true,
|
24136
|
+
replaceNode
|
24137
|
+
) : getSynthesizedDeepClone;
|
24138
|
+
const nodesClone = replaceNode ? (ns) => ns && getSynthesizedDeepClonesWithReplacements(
|
24139
|
+
ns,
|
24140
|
+
/*includeTrivia*/
|
24141
|
+
true,
|
24142
|
+
replaceNode
|
24143
|
+
) : (ns) => ns && getSynthesizedDeepClones(ns);
|
24144
|
+
const visited = visitEachChild(
|
24145
|
+
node,
|
24146
|
+
nodeClone,
|
24147
|
+
/*context*/
|
24148
|
+
void 0,
|
24149
|
+
nodesClone,
|
24150
|
+
nodeClone
|
24151
|
+
);
|
24152
|
+
if (visited === node) {
|
24153
|
+
const clone2 = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) : isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) : factory.cloneNode(node);
|
24154
|
+
return setTextRange(clone2, node);
|
24155
|
+
}
|
24156
|
+
visited.parent = void 0;
|
24157
|
+
return visited;
|
24158
|
+
}
|
24159
|
+
function getSynthesizedDeepClones(nodes, includeTrivia = true) {
|
24160
|
+
if (nodes) {
|
24161
|
+
const cloned = factory.createNodeArray(nodes.map((n) => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma);
|
24162
|
+
setTextRange(cloned, nodes);
|
24163
|
+
return cloned;
|
24164
|
+
}
|
24165
|
+
return nodes;
|
24166
|
+
}
|
24167
|
+
function getSynthesizedDeepClonesWithReplacements(nodes, includeTrivia, replaceNode) {
|
24168
|
+
return factory.createNodeArray(nodes.map((n) => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma);
|
24169
|
+
}
|
24170
|
+
function suppressLeadingAndTrailingTrivia(node) {
|
24171
|
+
suppressLeadingTrivia(node);
|
24172
|
+
suppressTrailingTrivia(node);
|
24173
|
+
}
|
24174
|
+
function suppressLeadingTrivia(node) {
|
24175
|
+
addEmitFlagsRecursively(node, 1024 /* NoLeadingComments */, getFirstChild);
|
24176
|
+
}
|
24177
|
+
function suppressTrailingTrivia(node) {
|
24178
|
+
addEmitFlagsRecursively(node, 2048 /* NoTrailingComments */, getLastChild);
|
24179
|
+
}
|
24180
|
+
function addEmitFlagsRecursively(node, flag, getChild) {
|
24181
|
+
addEmitFlags(node, flag);
|
24182
|
+
const child = getChild(node);
|
24183
|
+
if (child) addEmitFlagsRecursively(child, flag, getChild);
|
24184
|
+
}
|
24185
|
+
function getFirstChild(node) {
|
24186
|
+
return forEachChild(node, (child) => child);
|
24187
|
+
}
|
24112
24188
|
|
24113
24189
|
// src/compiler/factory/baseNodeFactory.ts
|
24114
24190
|
function createBaseNodeFactory() {
|
@@ -50986,11 +51062,11 @@ function createTypeChecker(host) {
|
|
50986
51062
|
typePredicateToString: (predicate, enclosingDeclaration, flags) => {
|
50987
51063
|
return typePredicateToString(predicate, getParseTreeNode(enclosingDeclaration), flags);
|
50988
51064
|
},
|
50989
|
-
writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
|
50990
|
-
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
|
51065
|
+
writeSignature: (signature, enclosingDeclaration, flags, kind, writer, verbosityLevel, out) => {
|
51066
|
+
return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer, verbosityLevel, out);
|
50991
51067
|
},
|
50992
|
-
writeType: (type, enclosingDeclaration, flags, writer) => {
|
50993
|
-
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
|
51068
|
+
writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
|
51069
|
+
return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
|
50994
51070
|
},
|
50995
51071
|
writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
|
50996
51072
|
return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
|
@@ -51224,7 +51300,8 @@ function createTypeChecker(host) {
|
|
51224
51300
|
isTypeParameterPossiblyReferenced,
|
51225
51301
|
typeHasCallOrConstructSignatures,
|
51226
51302
|
getSymbolFlags,
|
51227
|
-
getTypeArgumentsForResolvedSignature
|
51303
|
+
getTypeArgumentsForResolvedSignature,
|
51304
|
+
isLibType
|
51228
51305
|
};
|
51229
51306
|
function getTypeArgumentsForResolvedSignature(signature) {
|
51230
51307
|
if (signature.mapper === void 0) return void 0;
|
@@ -54901,7 +54978,7 @@ function createTypeChecker(host) {
|
|
54901
54978
|
return writer2;
|
54902
54979
|
}
|
54903
54980
|
}
|
54904
|
-
function signatureToString(signature, enclosingDeclaration, flags = 0 /* None */, kind, writer) {
|
54981
|
+
function signatureToString(signature, enclosingDeclaration, flags = 0 /* None */, kind, writer, verbosityLevel, out) {
|
54905
54982
|
return writer ? signatureToStringWorker(writer).getText() : usingSingleLineStringWriter(signatureToStringWorker);
|
54906
54983
|
function signatureToStringWorker(writer2) {
|
54907
54984
|
let sigOutput;
|
@@ -54910,7 +54987,18 @@ function createTypeChecker(host) {
|
|
54910
54987
|
} else {
|
54911
54988
|
sigOutput = kind === 1 /* Construct */ ? 180 /* ConstructSignature */ : 179 /* CallSignature */;
|
54912
54989
|
}
|
54913
|
-
const sig = nodeBuilder.signatureToSignatureDeclaration(
|
54990
|
+
const sig = nodeBuilder.signatureToSignatureDeclaration(
|
54991
|
+
signature,
|
54992
|
+
sigOutput,
|
54993
|
+
enclosingDeclaration,
|
54994
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */,
|
54995
|
+
/*internalFlags*/
|
54996
|
+
void 0,
|
54997
|
+
/*tracker*/
|
54998
|
+
void 0,
|
54999
|
+
verbosityLevel,
|
55000
|
+
out
|
55001
|
+
);
|
54914
55002
|
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
|
54915
55003
|
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
|
54916
55004
|
printer.writeNode(
|
@@ -54923,14 +55011,18 @@ function createTypeChecker(host) {
|
|
54923
55011
|
return writer2;
|
54924
55012
|
}
|
54925
55013
|
}
|
54926
|
-
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
|
55014
|
+
function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), verbosityLevel, out) {
|
54927
55015
|
const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
|
54928
55016
|
const typeNode = nodeBuilder.typeToTypeNode(
|
54929
55017
|
type,
|
54930
55018
|
enclosingDeclaration,
|
54931
|
-
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0
|
55019
|
+
toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
|
54932
55020
|
/*internalFlags*/
|
54933
|
-
void 0
|
55021
|
+
void 0,
|
55022
|
+
/*tracker*/
|
55023
|
+
void 0,
|
55024
|
+
verbosityLevel,
|
55025
|
+
out
|
54934
55026
|
);
|
54935
55027
|
if (typeNode === void 0) return Debug.fail("should always get typenode");
|
54936
55028
|
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
|
@@ -55161,31 +55253,120 @@ function createTypeChecker(host) {
|
|
55161
55253
|
};
|
55162
55254
|
return {
|
55163
55255
|
syntacticBuilderResolver,
|
55164
|
-
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
55165
|
-
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55166
|
-
|
55167
|
-
|
55168
|
-
|
55169
|
-
|
55170
|
-
|
55171
|
-
|
55172
|
-
|
55173
|
-
|
55174
|
-
)
|
55175
|
-
|
55176
|
-
|
55177
|
-
|
55178
|
-
|
55179
|
-
|
55180
|
-
|
55181
|
-
|
55182
|
-
)
|
55183
|
-
|
55184
|
-
|
55185
|
-
|
55186
|
-
|
55187
|
-
|
55188
|
-
|
55256
|
+
typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out),
|
55257
|
+
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55258
|
+
enclosingDeclaration,
|
55259
|
+
flags,
|
55260
|
+
internalFlags,
|
55261
|
+
tracker,
|
55262
|
+
/*verbosityLevel*/
|
55263
|
+
void 0,
|
55264
|
+
(context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)
|
55265
|
+
),
|
55266
|
+
serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55267
|
+
enclosingDeclaration,
|
55268
|
+
flags,
|
55269
|
+
internalFlags,
|
55270
|
+
tracker,
|
55271
|
+
/*verbosityLevel*/
|
55272
|
+
void 0,
|
55273
|
+
(context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)
|
55274
|
+
),
|
55275
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55276
|
+
enclosingDeclaration,
|
55277
|
+
flags,
|
55278
|
+
internalFlags,
|
55279
|
+
tracker,
|
55280
|
+
/*verbosityLevel*/
|
55281
|
+
void 0,
|
55282
|
+
(context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
|
55283
|
+
),
|
55284
|
+
serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55285
|
+
enclosingDeclaration,
|
55286
|
+
flags,
|
55287
|
+
internalFlags,
|
55288
|
+
tracker,
|
55289
|
+
/*verbosityLevel*/
|
55290
|
+
void 0,
|
55291
|
+
(context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
|
55292
|
+
),
|
55293
|
+
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55294
|
+
enclosingDeclaration,
|
55295
|
+
flags,
|
55296
|
+
internalFlags,
|
55297
|
+
tracker,
|
55298
|
+
/*verbosityLevel*/
|
55299
|
+
void 0,
|
55300
|
+
(context) => indexInfoToIndexSignatureDeclarationHelper(
|
55301
|
+
indexInfo,
|
55302
|
+
context,
|
55303
|
+
/*typeNode*/
|
55304
|
+
void 0
|
55305
|
+
)
|
55306
|
+
),
|
55307
|
+
signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => signatureToSignatureDeclarationHelper(signature, kind, context), out),
|
55308
|
+
symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55309
|
+
enclosingDeclaration,
|
55310
|
+
flags,
|
55311
|
+
internalFlags,
|
55312
|
+
tracker,
|
55313
|
+
/*verbosityLevel*/
|
55314
|
+
void 0,
|
55315
|
+
(context) => symbolToName(
|
55316
|
+
symbol,
|
55317
|
+
context,
|
55318
|
+
meaning,
|
55319
|
+
/*expectsIdentifier*/
|
55320
|
+
false
|
55321
|
+
)
|
55322
|
+
),
|
55323
|
+
symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55324
|
+
enclosingDeclaration,
|
55325
|
+
flags,
|
55326
|
+
internalFlags,
|
55327
|
+
tracker,
|
55328
|
+
/*verbosityLevel*/
|
55329
|
+
void 0,
|
55330
|
+
(context) => symbolToExpression(symbol, context, meaning)
|
55331
|
+
),
|
55332
|
+
symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55333
|
+
enclosingDeclaration,
|
55334
|
+
flags,
|
55335
|
+
internalFlags,
|
55336
|
+
tracker,
|
55337
|
+
/*verbosityLevel*/
|
55338
|
+
void 0,
|
55339
|
+
(context) => typeParametersToTypeParameterDeclarations(symbol, context)
|
55340
|
+
),
|
55341
|
+
symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55342
|
+
enclosingDeclaration,
|
55343
|
+
flags,
|
55344
|
+
internalFlags,
|
55345
|
+
tracker,
|
55346
|
+
/*verbosityLevel*/
|
55347
|
+
void 0,
|
55348
|
+
(context) => symbolToParameterDeclaration(symbol, context)
|
55349
|
+
),
|
55350
|
+
typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context), out),
|
55351
|
+
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55352
|
+
enclosingDeclaration,
|
55353
|
+
flags,
|
55354
|
+
internalFlags,
|
55355
|
+
tracker,
|
55356
|
+
/*verbosityLevel*/
|
55357
|
+
void 0,
|
55358
|
+
(context) => symbolTableToDeclarationStatements(symbolTable, context)
|
55359
|
+
),
|
55360
|
+
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
|
55361
|
+
enclosingDeclaration,
|
55362
|
+
flags,
|
55363
|
+
internalFlags,
|
55364
|
+
tracker,
|
55365
|
+
/*verbosityLevel*/
|
55366
|
+
void 0,
|
55367
|
+
(context) => symbolToNode(symbol, context, meaning)
|
55368
|
+
),
|
55369
|
+
symbolToDeclarations
|
55189
55370
|
};
|
55190
55371
|
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
55191
55372
|
const type = getTypeFromTypeNodeWithoutContext(node);
|
@@ -55227,7 +55408,75 @@ function createTypeChecker(host) {
|
|
55227
55408
|
}
|
55228
55409
|
return symbolToExpression(symbol, context, meaning);
|
55229
55410
|
}
|
55230
|
-
function
|
55411
|
+
function symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out) {
|
55412
|
+
const nodes = withContext2(
|
55413
|
+
/*enclosingDeclaration*/
|
55414
|
+
void 0,
|
55415
|
+
flags,
|
55416
|
+
/*internalFlags*/
|
55417
|
+
void 0,
|
55418
|
+
/*tracker*/
|
55419
|
+
void 0,
|
55420
|
+
verbosityLevel,
|
55421
|
+
(context) => symbolToDeclarationsWorker(symbol, context),
|
55422
|
+
out
|
55423
|
+
);
|
55424
|
+
return mapDefined(nodes, (node) => {
|
55425
|
+
switch (node.kind) {
|
55426
|
+
case 263 /* ClassDeclaration */:
|
55427
|
+
return simplifyClassDeclaration(node, symbol);
|
55428
|
+
case 266 /* EnumDeclaration */:
|
55429
|
+
return simplifyModifiers(node, isEnumDeclaration, symbol);
|
55430
|
+
case 264 /* InterfaceDeclaration */:
|
55431
|
+
return simplifyInterfaceDeclaration(node, symbol, meaning);
|
55432
|
+
case 267 /* ModuleDeclaration */:
|
55433
|
+
return simplifyModifiers(node, isModuleDeclaration, symbol);
|
55434
|
+
default:
|
55435
|
+
return void 0;
|
55436
|
+
}
|
55437
|
+
});
|
55438
|
+
}
|
55439
|
+
function simplifyClassDeclaration(classDecl, symbol) {
|
55440
|
+
const classDeclarations = filter(symbol.declarations, isClassLike);
|
55441
|
+
const originalClassDecl = classDeclarations && classDeclarations.length > 0 ? classDeclarations[0] : classDecl;
|
55442
|
+
const modifiers = getEffectiveModifierFlags(originalClassDecl) & ~(32 /* Export */ | 128 /* Ambient */);
|
55443
|
+
const isAnonymous = isClassExpression(originalClassDecl);
|
55444
|
+
if (isAnonymous) {
|
55445
|
+
classDecl = factory.updateClassDeclaration(
|
55446
|
+
classDecl,
|
55447
|
+
classDecl.modifiers,
|
55448
|
+
/*name*/
|
55449
|
+
void 0,
|
55450
|
+
classDecl.typeParameters,
|
55451
|
+
classDecl.heritageClauses,
|
55452
|
+
classDecl.members
|
55453
|
+
);
|
55454
|
+
}
|
55455
|
+
return factory.replaceModifiers(classDecl, modifiers);
|
55456
|
+
}
|
55457
|
+
function simplifyModifiers(newDecl, isDeclKind, symbol) {
|
55458
|
+
const decls = filter(symbol.declarations, isDeclKind);
|
55459
|
+
const declWithModifiers = decls && decls.length > 0 ? decls[0] : newDecl;
|
55460
|
+
const modifiers = getEffectiveModifierFlags(declWithModifiers) & ~(32 /* Export */ | 128 /* Ambient */);
|
55461
|
+
return factory.replaceModifiers(newDecl, modifiers);
|
55462
|
+
}
|
55463
|
+
function simplifyInterfaceDeclaration(interfaceDecl, symbol, meaning) {
|
55464
|
+
if (!(meaning & 64 /* Interface */)) {
|
55465
|
+
return void 0;
|
55466
|
+
}
|
55467
|
+
return simplifyModifiers(interfaceDecl, isInterfaceDeclaration, symbol);
|
55468
|
+
}
|
55469
|
+
function symbolToDeclarationsWorker(symbol, context) {
|
55470
|
+
const type = getDeclaredTypeOfSymbol(symbol);
|
55471
|
+
context.typeStack.push(type.id);
|
55472
|
+
context.typeStack.push(-1);
|
55473
|
+
const table = createSymbolTable([symbol]);
|
55474
|
+
const statements = symbolTableToDeclarationStatements(table, context);
|
55475
|
+
context.typeStack.pop();
|
55476
|
+
context.typeStack.pop();
|
55477
|
+
return statements;
|
55478
|
+
}
|
55479
|
+
function withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, cb, out) {
|
55231
55480
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
55232
55481
|
const context = {
|
55233
55482
|
enclosingDeclaration,
|
@@ -55235,6 +55484,7 @@ function createTypeChecker(host) {
|
|
55235
55484
|
flags: flags || 0 /* None */,
|
55236
55485
|
internalFlags: internalFlags || 0 /* None */,
|
55237
55486
|
tracker: void 0,
|
55487
|
+
maxExpansionDepth: verbosityLevel ?? -1,
|
55238
55488
|
encounteredError: false,
|
55239
55489
|
suppressReportInferenceFallback: false,
|
55240
55490
|
reportedDiagnostic: false,
|
@@ -55256,13 +55506,23 @@ function createTypeChecker(host) {
|
|
55256
55506
|
typeParameterNamesByText: void 0,
|
55257
55507
|
typeParameterNamesByTextNextNameCount: void 0,
|
55258
55508
|
enclosingSymbolTypes: /* @__PURE__ */ new Map(),
|
55259
|
-
mapper: void 0
|
55509
|
+
mapper: void 0,
|
55510
|
+
depth: 0,
|
55511
|
+
typeStack: [],
|
55512
|
+
out: {
|
55513
|
+
canIncreaseExpansionDepth: false,
|
55514
|
+
truncated: false
|
55515
|
+
}
|
55260
55516
|
};
|
55261
55517
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
55262
55518
|
const resultingNode = cb(context);
|
55263
55519
|
if (context.truncating && context.flags & 1 /* NoTruncation */) {
|
55264
55520
|
context.tracker.reportTruncationError();
|
55265
55521
|
}
|
55522
|
+
if (out) {
|
55523
|
+
out.canIncreaseExpansionDepth = context.out.canIncreaseExpansionDepth;
|
55524
|
+
out.truncated = context.out.truncated;
|
55525
|
+
}
|
55266
55526
|
return context.encounteredError ? void 0 : resultingNode;
|
55267
55527
|
}
|
55268
55528
|
function addSymbolTypeToContext(context, symbol, type) {
|
@@ -55281,19 +55541,49 @@ function createTypeChecker(host) {
|
|
55281
55541
|
function saveRestoreFlags(context) {
|
55282
55542
|
const flags = context.flags;
|
55283
55543
|
const internalFlags = context.internalFlags;
|
55544
|
+
const depth = context.depth;
|
55284
55545
|
return restore;
|
55285
55546
|
function restore() {
|
55286
55547
|
context.flags = flags;
|
55287
55548
|
context.internalFlags = internalFlags;
|
55549
|
+
context.depth = depth;
|
55288
55550
|
}
|
55289
55551
|
}
|
55552
|
+
function checkTruncationLengthIfExpanding(context) {
|
55553
|
+
return context.maxExpansionDepth >= 0 && checkTruncationLength(context);
|
55554
|
+
}
|
55290
55555
|
function checkTruncationLength(context) {
|
55291
55556
|
if (context.truncating) return context.truncating;
|
55292
55557
|
return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
|
55293
55558
|
}
|
55559
|
+
function canPossiblyExpandType(type, context) {
|
55560
|
+
for (let i = 0; i < context.typeStack.length - 1; i++) {
|
55561
|
+
if (context.typeStack[i] === type.id) {
|
55562
|
+
return false;
|
55563
|
+
}
|
55564
|
+
}
|
55565
|
+
return context.depth < context.maxExpansionDepth || context.depth === context.maxExpansionDepth && !context.out.canIncreaseExpansionDepth;
|
55566
|
+
}
|
55567
|
+
function shouldExpandType(type, context, isAlias = false) {
|
55568
|
+
if (!isAlias && isLibType(type)) {
|
55569
|
+
return false;
|
55570
|
+
}
|
55571
|
+
for (let i = 0; i < context.typeStack.length - 1; i++) {
|
55572
|
+
if (context.typeStack[i] === type.id) {
|
55573
|
+
return false;
|
55574
|
+
}
|
55575
|
+
}
|
55576
|
+
const result = context.depth < context.maxExpansionDepth;
|
55577
|
+
if (!result) {
|
55578
|
+
context.out.canIncreaseExpansionDepth = true;
|
55579
|
+
}
|
55580
|
+
return result;
|
55581
|
+
}
|
55294
55582
|
function typeToTypeNodeHelper(type, context) {
|
55295
55583
|
const restoreFlags = saveRestoreFlags(context);
|
55584
|
+
if (type) context.typeStack.push(type.id);
|
55296
55585
|
const typeNode = typeToTypeNodeWorker(type, context);
|
55586
|
+
if (type) context.typeStack.pop();
|
55297
55587
|
restoreFlags();
|
55298
55588
|
return typeNode;
|
55299
55589
|
}
|
@@ -55304,6 +55594,7 @@ function createTypeChecker(host) {
|
|
55304
55594
|
}
|
55305
55595
|
const inTypeAlias = context.flags & 8388608 /* InTypeAlias */;
|
55306
55596
|
context.flags &= ~8388608 /* InTypeAlias */;
|
55597
|
+
let expandingEnum = false;
|
55307
55598
|
if (!type) {
|
55308
55599
|
if (!(context.flags & 262144 /* AllowEmptyUnionOrIntersection */)) {
|
55309
55600
|
context.encounteredError = true;
|
@@ -55371,7 +55662,11 @@ function createTypeChecker(host) {
|
|
55371
55662
|
return Debug.fail("Unhandled type node kind returned from `symbolToTypeNode`.");
|
55372
55663
|
}
|
55373
55664
|
}
|
55374
|
-
|
55665
|
+
if (!shouldExpandType(type, context)) {
|
55666
|
+
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
55667
|
+
} else {
|
55668
|
+
expandingEnum = true;
|
55669
|
+
}
|
55375
55670
|
}
|
55376
55671
|
if (type.flags & 128 /* StringLiteral */) {
|
55377
55672
|
context.approximateLength += type.value.length + 2;
|
@@ -55438,16 +55733,34 @@ function createTypeChecker(host) {
|
|
55438
55733
|
return factory.createThisTypeNode();
|
55439
55734
|
}
|
55440
55735
|
if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
|
55441
|
-
|
55442
|
-
|
55443
|
-
|
55444
|
-
|
55736
|
+
if (!shouldExpandType(
|
55737
|
+
type,
|
55738
|
+
context,
|
55739
|
+
/*isAlias*/
|
55740
|
+
true
|
55741
|
+
)) {
|
55742
|
+
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
|
55743
|
+
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
|
55744
|
+
if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
|
55745
|
+
return factory.createArrayTypeNode(typeArgumentNodes[0]);
|
55746
|
+
}
|
55747
|
+
return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
|
55445
55748
|
}
|
55446
|
-
|
55749
|
+
context.depth += 1;
|
55447
55750
|
}
|
55448
55751
|
const objectFlags = getObjectFlags(type);
|
55449
55752
|
if (objectFlags & 4 /* Reference */) {
|
55450
55753
|
Debug.assert(!!(type.flags & 524288 /* Object */));
|
55754
|
+
if (shouldExpandType(type, context)) {
|
55755
|
+
context.depth += 1;
|
55756
|
+
return createAnonymousTypeNode(
|
55757
|
+
type,
|
55758
|
+
/*forceClassExpansion*/
|
55759
|
+
true,
|
55760
|
+
/*forceExpansion*/
|
55761
|
+
true
|
55762
|
+
);
|
55763
|
+
}
|
55451
55764
|
return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
|
55452
55765
|
}
|
55453
55766
|
if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
|
@@ -55477,6 +55790,16 @@ function createTypeChecker(host) {
|
|
55477
55790
|
void 0
|
55478
55791
|
);
|
55479
55792
|
}
|
55793
|
+
if (objectFlags & 3 /* ClassOrInterface */ && shouldExpandType(type, context)) {
|
55794
|
+
context.depth += 1;
|
55795
|
+
return createAnonymousTypeNode(
|
55796
|
+
type,
|
55797
|
+
/*forceClassExpansion*/
|
55798
|
+
true,
|
55799
|
+
/*forceExpansion*/
|
55800
|
+
true
|
55801
|
+
);
|
55802
|
+
}
|
55480
55803
|
if (type.symbol) {
|
55481
55804
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
|
55482
55805
|
}
|
@@ -55491,7 +55814,7 @@ function createTypeChecker(host) {
|
|
55491
55814
|
type = type.origin;
|
55492
55815
|
}
|
55493
55816
|
if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) {
|
55494
|
-
const types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types) : type.types;
|
55817
|
+
const types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types, expandingEnum) : type.types;
|
55495
55818
|
if (length(types) === 1) {
|
55496
55819
|
return typeToTypeNodeHelper(types[0], context);
|
55497
55820
|
}
|
@@ -55680,7 +56003,7 @@ function createTypeChecker(host) {
|
|
55680
56003
|
}
|
55681
56004
|
return result;
|
55682
56005
|
}
|
55683
|
-
function createAnonymousTypeNode(type2) {
|
56006
|
+
function createAnonymousTypeNode(type2, forceClassExpansion = false, forceExpansion = false) {
|
55684
56007
|
var _a2, _b2;
|
55685
56008
|
const typeId = type2.id;
|
55686
56009
|
const symbol = type2.symbol;
|
@@ -55703,15 +56026,20 @@ function createTypeChecker(host) {
|
|
55703
56026
|
const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
|
55704
56027
|
if (isJSConstructor(symbol.valueDeclaration)) {
|
55705
56028
|
return symbolToTypeNode(symbol, context, isInstanceType);
|
55706
|
-
} else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
56029
|
+
} else if (!forceExpansion && (symbol.flags & 32 /* Class */ && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
|
55707
56030
|
symbol,
|
55708
56031
|
context.enclosingDeclaration,
|
55709
56032
|
isInstanceType,
|
55710
56033
|
/*shouldComputeAliasesToMakeVisible*/
|
55711
56034
|
false
|
55712
|
-
).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) {
|
55713
|
-
|
55714
|
-
|
56035
|
+
).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol())) {
|
56036
|
+
if (shouldExpandType(type2, context)) {
|
56037
|
+
context.depth += 1;
|
56038
|
+
} else {
|
56039
|
+
return symbolToTypeNode(symbol, context, isInstanceType);
|
56040
|
+
}
|
56041
|
+
}
|
56042
|
+
if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
|
55715
56043
|
const typeAlias = getTypeAliasForTypeLiteral(type2);
|
55716
56044
|
if (typeAlias) {
|
55717
56045
|
return symbolToTypeNode(typeAlias, context, 788968 /* Type */);
|
@@ -55747,7 +56075,7 @@ function createTypeChecker(host) {
|
|
55747
56075
|
if (id && !context.symbolDepth) {
|
55748
56076
|
context.symbolDepth = /* @__PURE__ */ new Map();
|
55749
56077
|
}
|
55750
|
-
const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
56078
|
+
const links = context.maxExpansionDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
|
55751
56079
|
const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
|
55752
56080
|
if (links) {
|
55753
56081
|
links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
|
@@ -56064,6 +56392,7 @@ function createTypeChecker(host) {
|
|
56064
56392
|
}
|
56065
56393
|
function createTypeNodesFromResolvedType(resolvedType) {
|
56066
56394
|
if (checkTruncationLength(context)) {
|
56395
|
+
context.out.truncated = true;
|
56067
56396
|
if (context.flags & 1 /* NoTruncation */) {
|
56068
56397
|
return [addSyntheticTrailingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, "elided")];
|
56069
56398
|
}
|
@@ -56077,6 +56406,7 @@ function createTypeChecker(host) {
|
|
56077
56406
|
void 0
|
56078
56407
|
)];
|
56079
56408
|
}
|
56409
|
+
context.typeStack.push(-1);
|
56080
56410
|
const typeElements = [];
|
56081
56411
|
for (const signature of resolvedType.callSignatures) {
|
56082
56412
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 179 /* CallSignature */, context));
|
@@ -56090,10 +56420,14 @@ function createTypeChecker(host) {
|
|
56090
56420
|
}
|
56091
56421
|
const properties = resolvedType.properties;
|
56092
56422
|
if (!properties) {
|
56423
|
+
context.typeStack.pop();
|
56093
56424
|
return typeElements;
|
56094
56425
|
}
|
56095
56426
|
let i = 0;
|
56096
56427
|
for (const propertySymbol of properties) {
|
56428
|
+
if (isExpanding(context) && propertySymbol.flags & 4194304 /* Prototype */) {
|
56429
|
+
continue;
|
56430
|
+
}
|
56097
56431
|
i++;
|
56098
56432
|
if (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) {
|
56099
56433
|
if (propertySymbol.flags & 4194304 /* Prototype */) {
|
@@ -56104,6 +56438,7 @@ function createTypeChecker(host) {
|
|
56104
56438
|
}
|
56105
56439
|
}
|
56106
56440
|
if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
|
56441
|
+
context.out.truncated = true;
|
56107
56442
|
if (context.flags & 1 /* NoTruncation */) {
|
56108
56443
|
const typeElement = typeElements.pop();
|
56109
56444
|
typeElements.push(addSyntheticTrailingComment(typeElement, 3 /* MultiLineCommentTrivia */, `... ${properties.length - i} more elided ...`));
|
@@ -56123,6 +56458,7 @@ function createTypeChecker(host) {
|
|
56123
56458
|
}
|
56124
56459
|
addPropertyToElementList(propertySymbol, context, typeElements);
|
56125
56460
|
}
|
56461
|
+
context.typeStack.pop();
|
56126
56462
|
return typeElements.length ? typeElements : void 0;
|
56127
56463
|
}
|
56128
56464
|
}
|
@@ -56271,6 +56607,7 @@ function createTypeChecker(host) {
|
|
56271
56607
|
function mapToTypeNodes(types, context, isBareList) {
|
56272
56608
|
if (some(types)) {
|
56273
56609
|
if (checkTruncationLength(context)) {
|
56610
|
+
context.out.truncated = true;
|
56274
56611
|
if (!isBareList) {
|
56275
56612
|
return [
|
56276
56613
|
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "elided") : factory.createTypeReferenceNode(
|
@@ -56298,6 +56635,7 @@ function createTypeChecker(host) {
|
|
56298
56635
|
for (const type of types) {
|
56299
56636
|
i++;
|
56300
56637
|
if (checkTruncationLength(context) && i + 2 < types.length - 1) {
|
56638
|
+
context.out.truncated = true;
|
56301
56639
|
result.push(
|
56302
56640
|
context.flags & 1 /* NoTruncation */ ? addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, `... ${types.length - i} more elided ...`) : factory.createTypeReferenceNode(
|
56303
56641
|
`... ${types.length - i} more ...`,
|
@@ -56695,7 +57033,7 @@ function createTypeChecker(host) {
|
|
56695
57033
|
return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
|
56696
57034
|
}
|
56697
57035
|
function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
|
56698
|
-
return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
57036
|
+
return !canPossiblyExpandType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
|
56699
57037
|
}
|
56700
57038
|
function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
|
56701
57039
|
const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
|
@@ -57214,12 +57552,15 @@ function createTypeChecker(host) {
|
|
57214
57552
|
}
|
57215
57553
|
let firstChar = symbolName2.charCodeAt(0);
|
57216
57554
|
if (isSingleOrDoubleQuote(firstChar) && some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
57217
|
-
|
57555
|
+
const specifier = getSpecifierForModuleSymbol(symbol2, context);
|
57556
|
+
context.approximateLength += 2 + specifier.length;
|
57557
|
+
return factory.createStringLiteral(specifier);
|
57218
57558
|
}
|
57219
57559
|
if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) {
|
57220
57560
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
|
57221
57561
|
if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
|
57222
57562
|
identifier.symbol = symbol2;
|
57563
|
+
context.approximateLength += 1 + symbolName2.length;
|
57223
57564
|
return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
|
57224
57565
|
} else {
|
57225
57566
|
if (firstChar === 91 /* openBracket */) {
|
@@ -57228,16 +57569,21 @@ function createTypeChecker(host) {
|
|
57228
57569
|
}
|
57229
57570
|
let expression;
|
57230
57571
|
if (isSingleOrDoubleQuote(firstChar) && !(symbol2.flags & 8 /* EnumMember */)) {
|
57231
|
-
|
57572
|
+
const literalText = stripQuotes(symbolName2).replace(/\\./g, (s) => s.substring(1));
|
57573
|
+
context.approximateLength += literalText.length + 2;
|
57574
|
+
expression = factory.createStringLiteral(literalText, firstChar === 39 /* singleQuote */);
|
57232
57575
|
} else if ("" + +symbolName2 === symbolName2) {
|
57576
|
+
context.approximateLength += symbolName2.length;
|
57233
57577
|
expression = factory.createNumericLiteral(+symbolName2);
|
57234
57578
|
}
|
57235
57579
|
if (!expression) {
|
57236
57580
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
|
57237
57581
|
if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
|
57238
57582
|
identifier.symbol = symbol2;
|
57583
|
+
context.approximateLength += symbolName2.length;
|
57239
57584
|
expression = identifier;
|
57240
57585
|
}
|
57586
|
+
context.approximateLength += 2;
|
57241
57587
|
return factory.createElementAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), expression);
|
57242
57588
|
}
|
57243
57589
|
}
|
@@ -57266,6 +57612,10 @@ function createTypeChecker(host) {
|
|
57266
57612
|
), "'")));
|
57267
57613
|
}
|
57268
57614
|
function getPropertyNameNodeForSymbol(symbol, context) {
|
57615
|
+
const hashPrivateName = getClonedHashPrivateName(symbol);
|
57616
|
+
if (hashPrivateName) {
|
57617
|
+
return hashPrivateName;
|
57618
|
+
}
|
57269
57619
|
const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed);
|
57270
57620
|
const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed);
|
57271
57621
|
const isMethod = !!(symbol.flags & 8192 /* Method */);
|
@@ -57342,7 +57692,7 @@ function createTypeChecker(host) {
|
|
57342
57692
|
let result;
|
57343
57693
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
57344
57694
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
57345
|
-
if (decl) {
|
57695
|
+
if (!canPossiblyExpandType(type, context) && decl) {
|
57346
57696
|
const restore = addSymbolTypeToContext(context, symbol, type);
|
57347
57697
|
if (isAccessor(decl)) {
|
57348
57698
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
@@ -57381,7 +57731,7 @@ function createTypeChecker(host) {
|
|
57381
57731
|
let returnTypeNode;
|
57382
57732
|
const returnType = getReturnTypeOfSignature(signature);
|
57383
57733
|
if (!(suppressAny && isTypeAny(returnType))) {
|
57384
|
-
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
57734
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration) && !canPossiblyExpandType(returnType, context)) {
|
57385
57735
|
const declarationSymbol = getSymbolOfDeclaration(signature.declaration);
|
57386
57736
|
const restore = addSymbolTypeToContext(context, declarationSymbol, returnType);
|
57387
57737
|
returnTypeNode = syntacticNodeBuilder.serializeReturnTypeForSignature(signature.declaration, declarationSymbol, context);
|
@@ -57792,14 +58142,28 @@ function createTypeChecker(host) {
|
|
57792
58142
|
if (!suppressNewPrivateContext) {
|
57793
58143
|
deferredPrivatesStack.push(/* @__PURE__ */ new Map());
|
57794
58144
|
}
|
57795
|
-
|
58145
|
+
let i = 0;
|
58146
|
+
const symbols = Array.from(symbolTable2.values());
|
58147
|
+
for (const symbol of symbols) {
|
58148
|
+
i++;
|
58149
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < symbolTable2.size - 1) {
|
58150
|
+
context.out.truncated = true;
|
58151
|
+
results.push(createTruncationStatement(`... (${symbolTable2.size - i} more ...)`));
|
58152
|
+
serializeSymbol(
|
58153
|
+
symbols[symbols.length - 1],
|
58154
|
+
/*isPrivate*/
|
58155
|
+
false,
|
58156
|
+
!!propertyAsAlias
|
58157
|
+
);
|
58158
|
+
break;
|
58159
|
+
}
|
57796
58160
|
serializeSymbol(
|
57797
58161
|
symbol,
|
57798
58162
|
/*isPrivate*/
|
57799
58163
|
false,
|
57800
58164
|
!!propertyAsAlias
|
57801
58165
|
);
|
57802
|
-
}
|
58166
|
+
}
|
57803
58167
|
if (!suppressNewPrivateContext) {
|
57804
58168
|
deferredPrivatesStack[deferredPrivatesStack.length - 1].forEach((symbol) => {
|
57805
58169
|
serializeSymbol(
|
@@ -57829,7 +58193,7 @@ function createTypeChecker(host) {
|
|
57829
58193
|
}
|
57830
58194
|
}
|
57831
58195
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
57832
|
-
var _a2, _b, _c, _d, _e, _f;
|
58196
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
57833
58197
|
const symbolName2 = unescapeLeadingUnderscores(escapedSymbolName);
|
57834
58198
|
const isDefault = escapedSymbolName === "default" /* Default */;
|
57835
58199
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) {
|
@@ -57879,6 +58243,7 @@ function createTypeChecker(host) {
|
|
57879
58243
|
const propertyAccessRequire = (_e = symbol.declarations) == null ? void 0 : _e.find(isPropertyAccessExpression);
|
57880
58244
|
if (propertyAccessRequire && isBinaryExpression(propertyAccessRequire.parent) && isIdentifier(propertyAccessRequire.parent.right) && ((_f = type.symbol) == null ? void 0 : _f.valueDeclaration) && isSourceFile(type.symbol.valueDeclaration)) {
|
57881
58245
|
const alias = localName === propertyAccessRequire.parent.right.escapedText ? void 0 : propertyAccessRequire.parent.right;
|
58246
|
+
context.approximateLength += 12 + (((_g = alias == null ? void 0 : alias.escapedText) == null ? void 0 : _g.length) ?? 0);
|
57882
58247
|
addResult(
|
57883
58248
|
factory.createExportDeclaration(
|
57884
58249
|
/*modifiers*/
|
@@ -57918,8 +58283,10 @@ function createTypeChecker(host) {
|
|
57918
58283
|
),
|
57919
58284
|
textRange
|
57920
58285
|
);
|
58286
|
+
context.approximateLength += 7 + name.length;
|
57921
58287
|
addResult(statement, name !== localName ? modifierFlags & ~32 /* Export */ : modifierFlags);
|
57922
58288
|
if (name !== localName && !isPrivate) {
|
58289
|
+
context.approximateLength += 16 + name.length + localName.length;
|
57923
58290
|
addResult(
|
57924
58291
|
factory.createExportDeclaration(
|
57925
58292
|
/*modifiers*/
|
@@ -57969,27 +58336,33 @@ function createTypeChecker(host) {
|
|
57969
58336
|
for (const node of symbol.declarations) {
|
57970
58337
|
const resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
57971
58338
|
if (!resolvedModule) continue;
|
58339
|
+
const isTypeOnly = node.isTypeOnly;
|
58340
|
+
const specifier = getSpecifierForModuleSymbol(resolvedModule, context);
|
58341
|
+
context.approximateLength += 17 + specifier.length;
|
57972
58342
|
addResult(factory.createExportDeclaration(
|
57973
58343
|
/*modifiers*/
|
57974
58344
|
void 0,
|
57975
|
-
|
57976
|
-
node.isTypeOnly,
|
58345
|
+
isTypeOnly,
|
57977
58346
|
/*exportClause*/
|
57978
58347
|
void 0,
|
57979
|
-
factory.createStringLiteral(
|
58348
|
+
factory.createStringLiteral(specifier)
|
57980
58349
|
), 0 /* None */);
|
57981
58350
|
}
|
57982
58351
|
}
|
57983
58352
|
}
|
57984
58353
|
if (needsPostExportDefault) {
|
58354
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
58355
|
+
context.approximateLength += 16 + internalSymbolName.length;
|
57985
58356
|
addResult(factory.createExportAssignment(
|
57986
58357
|
/*modifiers*/
|
57987
58358
|
void 0,
|
57988
58359
|
/*isExportEquals*/
|
57989
58360
|
false,
|
57990
|
-
factory.createIdentifier(
|
58361
|
+
factory.createIdentifier(internalSymbolName)
|
57991
58362
|
), 0 /* None */);
|
57992
58363
|
} else if (needsExportDeclaration) {
|
58364
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
58365
|
+
context.approximateLength += 22 + symbolName2.length + internalSymbolName.length;
|
57993
58366
|
addResult(
|
57994
58367
|
factory.createExportDeclaration(
|
57995
58368
|
/*modifiers*/
|
@@ -57999,7 +58372,7 @@ function createTypeChecker(host) {
|
|
57999
58372
|
factory.createNamedExports([factory.createExportSpecifier(
|
58000
58373
|
/*isTypeOnly*/
|
58001
58374
|
false,
|
58002
|
-
|
58375
|
+
internalSymbolName,
|
58003
58376
|
symbolName2
|
58004
58377
|
)])
|
58005
58378
|
),
|
@@ -58019,6 +58392,7 @@ function createTypeChecker(host) {
|
|
58019
58392
|
}
|
58020
58393
|
function addResult(node, additionalModifierFlags) {
|
58021
58394
|
if (canHaveModifiers(node)) {
|
58395
|
+
const oldModifierFlags = getEffectiveModifierFlags(node);
|
58022
58396
|
let newModifierFlags = 0 /* None */;
|
58023
58397
|
const enclosingDeclaration2 = context.enclosingDeclaration && (isJSDocTypeAlias(context.enclosingDeclaration) ? getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
|
58024
58398
|
if (additionalModifierFlags & 32 /* Export */ && enclosingDeclaration2 && (isExportingScope(enclosingDeclaration2) || isModuleDeclaration(enclosingDeclaration2)) && canHaveExportModifier(node)) {
|
@@ -58031,8 +58405,9 @@ function createTypeChecker(host) {
|
|
58031
58405
|
newModifierFlags |= 2048 /* Default */;
|
58032
58406
|
}
|
58033
58407
|
if (newModifierFlags) {
|
58034
|
-
node = factory.replaceModifiers(node, newModifierFlags |
|
58408
|
+
node = factory.replaceModifiers(node, newModifierFlags | oldModifierFlags);
|
58035
58409
|
}
|
58410
|
+
context.approximateLength += modifiersLength(newModifierFlags | oldModifierFlags);
|
58036
58411
|
}
|
58037
58412
|
results.push(node);
|
58038
58413
|
}
|
@@ -58048,12 +58423,14 @@ function createTypeChecker(host) {
|
|
58048
58423
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
58049
58424
|
context.enclosingDeclaration = jsdocAliasDecl;
|
58050
58425
|
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && syntacticNodeBuilder.tryReuseExistingTypeNode(context, jsdocAliasDecl.typeExpression.type) || typeToTypeNodeHelper(aliasType, context);
|
58426
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
58427
|
+
context.approximateLength += 8 + ((commentText == null ? void 0 : commentText.length) ?? 0) + internalSymbolName.length;
|
58051
58428
|
addResult(
|
58052
58429
|
setSyntheticLeadingComments(
|
58053
58430
|
factory.createTypeAliasDeclaration(
|
58054
58431
|
/*modifiers*/
|
58055
58432
|
void 0,
|
58056
|
-
|
58433
|
+
internalSymbolName,
|
58057
58434
|
typeParamDecls,
|
58058
58435
|
typeNode
|
58059
58436
|
),
|
@@ -58065,12 +58442,19 @@ function createTypeChecker(host) {
|
|
58065
58442
|
context.enclosingDeclaration = oldEnclosingDecl;
|
58066
58443
|
}
|
58067
58444
|
function serializeInterface(symbol, symbolName2, modifierFlags) {
|
58445
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
58446
|
+
context.approximateLength += 14 + internalSymbolName.length;
|
58068
58447
|
const interfaceType = getDeclaredTypeOfClassOrInterface(symbol);
|
58069
58448
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
58070
58449
|
const typeParamDecls = map(localParams, (p) => typeParameterToDeclaration(p, context));
|
58071
58450
|
const baseTypes = getBaseTypes(interfaceType);
|
58072
58451
|
const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : void 0;
|
58073
|
-
const members =
|
58452
|
+
const members = serializePropertySymbolsForClassOrInterface(
|
58453
|
+
getPropertiesOfType(interfaceType),
|
58454
|
+
/*isClass*/
|
58455
|
+
false,
|
58456
|
+
baseType
|
58457
|
+
);
|
58074
58458
|
const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 179 /* CallSignature */);
|
58075
58459
|
const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 180 /* ConstructSignature */);
|
58076
58460
|
const indexSignatures = serializeIndexSignatures(interfaceType, baseType);
|
@@ -58079,7 +58463,7 @@ function createTypeChecker(host) {
|
|
58079
58463
|
factory.createInterfaceDeclaration(
|
58080
58464
|
/*modifiers*/
|
58081
58465
|
void 0,
|
58082
|
-
|
58466
|
+
internalSymbolName,
|
58083
58467
|
typeParamDecls,
|
58084
58468
|
heritageClauses,
|
58085
58469
|
[...indexSignatures, ...constructSignatures, ...callSignatures, ...members]
|
@@ -58087,6 +58471,57 @@ function createTypeChecker(host) {
|
|
58087
58471
|
modifierFlags
|
58088
58472
|
);
|
58089
58473
|
}
|
58474
|
+
function serializePropertySymbolsForClassOrInterface(props, isClass, baseType, isStatic2) {
|
58475
|
+
const elements = [];
|
58476
|
+
let i = 0;
|
58477
|
+
for (const prop of props) {
|
58478
|
+
i++;
|
58479
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < props.length - 1) {
|
58480
|
+
context.out.truncated = true;
|
58481
|
+
const placeholder = createTruncationProperty(`... ${props.length - i} more ... `, isClass);
|
58482
|
+
elements.push(placeholder);
|
58483
|
+
const result2 = isClass ? serializePropertySymbolForClass(props[props.length - 1], isStatic2, baseType) : serializePropertySymbolForInterface(props[props.length - 1], baseType);
|
58484
|
+
if (isArray(result2)) {
|
58485
|
+
elements.push(...result2);
|
58486
|
+
} else {
|
58487
|
+
elements.push(result2);
|
58488
|
+
}
|
58489
|
+
break;
|
58490
|
+
}
|
58491
|
+
context.approximateLength += 1;
|
58492
|
+
const result = isClass ? serializePropertySymbolForClass(prop, isStatic2, baseType) : serializePropertySymbolForInterface(prop, baseType);
|
58493
|
+
if (isArray(result)) {
|
58494
|
+
elements.push(...result);
|
58495
|
+
} else {
|
58496
|
+
elements.push(result);
|
58497
|
+
}
|
58498
|
+
}
|
58499
|
+
return elements;
|
58500
|
+
}
|
58501
|
+
function createTruncationProperty(dotDotDotText, isClass) {
|
58502
|
+
if (context.flags & 1 /* NoTruncation */) {
|
58503
|
+
return addSyntheticLeadingComment(factory.createNotEmittedTypeElement(), 3 /* MultiLineCommentTrivia */, dotDotDotText);
|
58504
|
+
}
|
58505
|
+
return isClass ? factory.createPropertyDeclaration(
|
58506
|
+
/*modifiers*/
|
58507
|
+
void 0,
|
58508
|
+
dotDotDotText,
|
58509
|
+
/*questionOrExclamationToken*/
|
58510
|
+
void 0,
|
58511
|
+
/*type*/
|
58512
|
+
void 0,
|
58513
|
+
/*initializer*/
|
58514
|
+
void 0
|
58515
|
+
) : factory.createPropertySignature(
|
58516
|
+
/*modifiers*/
|
58517
|
+
void 0,
|
58518
|
+
dotDotDotText,
|
58519
|
+
/*questionToken*/
|
58520
|
+
void 0,
|
58521
|
+
/*type*/
|
58522
|
+
void 0
|
58523
|
+
);
|
58524
|
+
}
|
58090
58525
|
function getNamespaceMembersForSerialization(symbol) {
|
58091
58526
|
let exports2 = arrayFrom(getExportsOfSymbol(symbol).values());
|
58092
58527
|
const merged = getMergedSymbol(symbol);
|
@@ -58106,11 +58541,27 @@ function createTypeChecker(host) {
|
|
58106
58541
|
}
|
58107
58542
|
function serializeModule(symbol, symbolName2, modifierFlags) {
|
58108
58543
|
const members = getNamespaceMembersForSerialization(symbol);
|
58109
|
-
const
|
58544
|
+
const expanding = isExpanding(context);
|
58545
|
+
const locationMap = arrayToMultiMap(members, (m) => m.parent && m.parent === symbol || expanding ? "real" : "merged");
|
58110
58546
|
const realMembers = locationMap.get("real") || emptyArray;
|
58111
58547
|
const mergedMembers = locationMap.get("merged") || emptyArray;
|
58112
|
-
if (length(realMembers)) {
|
58113
|
-
|
58548
|
+
if (length(realMembers) || expanding) {
|
58549
|
+
let localName;
|
58550
|
+
if (expanding) {
|
58551
|
+
const oldFlags = context.flags;
|
58552
|
+
context.flags |= 512 /* WriteTypeParametersInQualifiedName */ | 2 /* UseOnlyExternalAliasing */;
|
58553
|
+
localName = symbolToNode(
|
58554
|
+
symbol,
|
58555
|
+
context,
|
58556
|
+
/*meaning*/
|
58557
|
+
-1 /* All */
|
58558
|
+
);
|
58559
|
+
context.flags = oldFlags;
|
58560
|
+
} else {
|
58561
|
+
const localText = getInternalSymbolName(symbol, symbolName2);
|
58562
|
+
localName = factory.createIdentifier(localText);
|
58563
|
+
context.approximateLength += localText.length;
|
58564
|
+
}
|
58114
58565
|
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & (16 /* Function */ | 67108864 /* Assignment */)));
|
58115
58566
|
}
|
58116
58567
|
if (length(mergedMembers)) {
|
@@ -58158,17 +58609,51 @@ function createTypeChecker(host) {
|
|
58158
58609
|
}
|
58159
58610
|
}
|
58160
58611
|
function serializeEnum(symbol, symbolName2, modifierFlags) {
|
58612
|
+
const internalSymbolName = getInternalSymbolName(symbol, symbolName2);
|
58613
|
+
context.approximateLength += 9 + internalSymbolName.length;
|
58614
|
+
const members = [];
|
58615
|
+
const memberProps = filter(getPropertiesOfType(getTypeOfSymbol(symbol)), (p) => !!(p.flags & 8 /* EnumMember */));
|
58616
|
+
let i = 0;
|
58617
|
+
for (const p of memberProps) {
|
58618
|
+
i++;
|
58619
|
+
if (checkTruncationLengthIfExpanding(context) && i + 2 < memberProps.length - 1) {
|
58620
|
+
context.out.truncated = true;
|
58621
|
+
members.push(factory.createEnumMember(` ... ${memberProps.length - i} more ... `));
|
58622
|
+
const last2 = memberProps[memberProps.length - 1];
|
58623
|
+
const initializedValue = last2.declarations && last2.declarations[0] && isEnumMember(last2.declarations[0]) ? getConstantValue2(last2.declarations[0]) : void 0;
|
58624
|
+
const initializer2 = initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue);
|
58625
|
+
const memberName2 = unescapeLeadingUnderscores(last2.escapedName);
|
58626
|
+
const member2 = factory.createEnumMember(
|
58627
|
+
memberName2,
|
58628
|
+
initializer2
|
58629
|
+
);
|
58630
|
+
members.push(member2);
|
58631
|
+
break;
|
58632
|
+
}
|
58633
|
+
const memberDecl = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? p.declarations[0] : void 0;
|
58634
|
+
let initializer;
|
58635
|
+
let initializerLength;
|
58636
|
+
if (isExpanding(context) && memberDecl && memberDecl.initializer) {
|
58637
|
+
initializer = getSynthesizedDeepClone(memberDecl.initializer);
|
58638
|
+
initializerLength = memberDecl.initializer.end - memberDecl.initializer.pos;
|
58639
|
+
} else {
|
58640
|
+
const initializedValue = memberDecl && getConstantValue2(memberDecl);
|
58641
|
+
initializer = initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue);
|
58642
|
+
initializerLength = (initializer == null ? void 0 : initializer.text.length) ?? 0;
|
58643
|
+
}
|
58644
|
+
const memberName = unescapeLeadingUnderscores(p.escapedName);
|
58645
|
+
context.approximateLength += 4 + memberName.length + initializerLength;
|
58646
|
+
const member = factory.createEnumMember(
|
58647
|
+
memberName,
|
58648
|
+
initializer
|
58649
|
+
);
|
58650
|
+
members.push(member);
|
58651
|
+
}
|
58161
58652
|
addResult(
|
58162
58653
|
factory.createEnumDeclaration(
|
58163
58654
|
factory.createModifiersFromModifierFlags(isConstEnumSymbol(symbol) ? 4096 /* Const */ : 0),
|
58164
|
-
|
58165
|
-
|
58166
|
-
const initializedValue = p.declarations && p.declarations[0] && isEnumMember(p.declarations[0]) ? getConstantValue2(p.declarations[0]) : void 0;
|
58167
|
-
return factory.createEnumMember(
|
58168
|
-
unescapeLeadingUnderscores(p.escapedName),
|
58169
|
-
initializedValue === void 0 ? void 0 : typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) : factory.createNumericLiteral(initializedValue)
|
58170
|
-
);
|
58171
|
-
})
|
58655
|
+
internalSymbolName,
|
58656
|
+
members
|
58172
58657
|
),
|
58173
58658
|
modifierFlags
|
58174
58659
|
);
|
@@ -58176,20 +58661,28 @@ function createTypeChecker(host) {
|
|
58176
58661
|
function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) {
|
58177
58662
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
58178
58663
|
for (const sig of signatures) {
|
58664
|
+
context.approximateLength += 1;
|
58179
58665
|
const decl = signatureToSignatureDeclarationHelper(sig, 262 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName) });
|
58180
58666
|
addResult(setTextRange2(context, decl, getSignatureTextRangeLocation(sig)), modifierFlags);
|
58181
58667
|
}
|
58182
58668
|
if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) {
|
58183
58669
|
const props = filter(getPropertiesOfType(type), isNamespaceMember);
|
58670
|
+
context.approximateLength += localName.length;
|
58184
58671
|
serializeAsNamespaceDeclaration(
|
58185
58672
|
props,
|
58186
|
-
localName,
|
58673
|
+
factory.createIdentifier(localName),
|
58187
58674
|
modifierFlags,
|
58188
58675
|
/*suppressNewPrivateContext*/
|
58189
58676
|
true
|
58190
58677
|
);
|
58191
58678
|
}
|
58192
58679
|
}
|
58680
|
+
function createTruncationStatement(dotDotDotText) {
|
58681
|
+
if (context.flags & 1 /* NoTruncation */) {
|
58682
|
+
return addSyntheticLeadingComment(factory.createEmptyStatement(), 3 /* MultiLineCommentTrivia */, dotDotDotText);
|
58683
|
+
}
|
58684
|
+
return factory.createExpressionStatement(factory.createIdentifier(dotDotDotText));
|
58685
|
+
}
|
58193
58686
|
function getSignatureTextRangeLocation(signature) {
|
58194
58687
|
if (signature.declaration && signature.declaration.parent) {
|
58195
58688
|
if (isBinaryExpression(signature.declaration.parent) && getAssignmentDeclarationKind(signature.declaration.parent) === 5 /* Property */) {
|
@@ -58202,15 +58695,18 @@ function createTypeChecker(host) {
|
|
58202
58695
|
return signature.declaration;
|
58203
58696
|
}
|
58204
58697
|
function serializeAsNamespaceDeclaration(props, localName, modifierFlags, suppressNewPrivateContext) {
|
58698
|
+
const nodeFlags = isIdentifier(localName) ? 32 /* Namespace */ : 0 /* None */;
|
58699
|
+
const expanding = isExpanding(context);
|
58205
58700
|
if (length(props)) {
|
58206
|
-
|
58701
|
+
context.approximateLength += 14;
|
58702
|
+
const localVsRemoteMap = arrayToMultiMap(props, (p) => !length(p.declarations) || some(p.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)) || expanding ? "local" : "remote");
|
58207
58703
|
const localProps = localVsRemoteMap.get("local") || emptyArray;
|
58208
58704
|
let fakespace = parseNodeFactory.createModuleDeclaration(
|
58209
58705
|
/*modifiers*/
|
58210
58706
|
void 0,
|
58211
|
-
|
58707
|
+
localName,
|
58212
58708
|
factory.createModuleBlock([]),
|
58213
|
-
|
58709
|
+
nodeFlags
|
58214
58710
|
);
|
58215
58711
|
setParent(fakespace, enclosingDeclaration);
|
58216
58712
|
fakespace.locals = createSymbolTable(props);
|
@@ -58252,6 +58748,18 @@ function createTypeChecker(host) {
|
|
58252
58748
|
factory.createModuleBlock(exportModifierStripped)
|
58253
58749
|
);
|
58254
58750
|
addResult(fakespace, modifierFlags);
|
58751
|
+
} else if (expanding) {
|
58752
|
+
context.approximateLength += 14;
|
58753
|
+
addResult(
|
58754
|
+
factory.createModuleDeclaration(
|
58755
|
+
/*modifiers*/
|
58756
|
+
void 0,
|
58757
|
+
localName,
|
58758
|
+
factory.createModuleBlock([]),
|
58759
|
+
nodeFlags
|
58760
|
+
),
|
58761
|
+
modifierFlags
|
58762
|
+
);
|
58255
58763
|
}
|
58256
58764
|
}
|
58257
58765
|
function isNamespaceMember(p) {
|
@@ -58294,11 +58802,13 @@ function createTypeChecker(host) {
|
|
58294
58802
|
}
|
58295
58803
|
function serializeAsClass(symbol, localName, modifierFlags) {
|
58296
58804
|
var _a2, _b;
|
58805
|
+
context.approximateLength += 9 + localName.length;
|
58297
58806
|
const originalDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike);
|
58298
58807
|
const oldEnclosing = context.enclosingDeclaration;
|
58299
58808
|
context.enclosingDeclaration = originalDecl || oldEnclosing;
|
58300
58809
|
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
58301
58810
|
const typeParamDecls = map(localParams, (p) => typeParameterToDeclaration(p, context));
|
58811
|
+
forEach(localParams, (p) => context.approximateLength += symbolName(p.symbol).length);
|
58302
58812
|
const classType = getTypeWithThisArgument(getDeclaredTypeOfClassOrInterface(symbol));
|
58303
58813
|
const baseTypes = getBaseTypes(classType);
|
58304
58814
|
const originalImplements = originalDecl && getEffectiveImplementsTypeNodes(originalDecl);
|
@@ -58306,20 +58816,22 @@ function createTypeChecker(host) {
|
|
58306
58816
|
const staticType = getTypeOfSymbol(symbol);
|
58307
58817
|
const isClass = !!((_b = staticType.symbol) == null ? void 0 : _b.valueDeclaration) && isClassLike(staticType.symbol.valueDeclaration);
|
58308
58818
|
const staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType) : anyType;
|
58819
|
+
context.approximateLength += (length(baseTypes) ? 8 : 0) + (length(implementsExpressions) ? 11 : 0);
|
58309
58820
|
const heritageClauses = [
|
58310
58821
|
...!length(baseTypes) ? [] : [factory.createHeritageClause(96 /* ExtendsKeyword */, map(baseTypes, (b) => serializeBaseType(b, staticBaseType, localName)))],
|
58311
58822
|
...!length(implementsExpressions) ? [] : [factory.createHeritageClause(119 /* ImplementsKeyword */, implementsExpressions)]
|
58312
58823
|
];
|
58313
58824
|
const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType));
|
58314
|
-
const publicSymbolProps = filter(symbolProps, (s) =>
|
58315
|
-
|
58316
|
-
|
58317
|
-
|
58318
|
-
|
58319
|
-
|
58320
|
-
|
58321
|
-
|
58322
|
-
|
58825
|
+
const publicSymbolProps = filter(symbolProps, (s) => !isHashPrivate(s));
|
58826
|
+
const hasPrivateIdentifier = some(symbolProps, isHashPrivate);
|
58827
|
+
const privateProperties = hasPrivateIdentifier ? isExpanding(context) ? serializePropertySymbolsForClassOrInterface(
|
58828
|
+
filter(symbolProps, isHashPrivate),
|
58829
|
+
/*isClass*/
|
58830
|
+
true,
|
58831
|
+
baseTypes[0],
|
58832
|
+
/*isStatic*/
|
58833
|
+
false
|
58834
|
+
) : [factory.createPropertyDeclaration(
|
58323
58835
|
/*modifiers*/
|
58324
58836
|
void 0,
|
58325
58837
|
factory.createPrivateIdentifier("#private"),
|
@@ -58330,22 +58842,27 @@ function createTypeChecker(host) {
|
|
58330
58842
|
/*initializer*/
|
58331
58843
|
void 0
|
58332
58844
|
)] : emptyArray;
|
58333
|
-
|
58334
|
-
|
58845
|
+
if (hasPrivateIdentifier && !isExpanding(context)) {
|
58846
|
+
context.approximateLength += 9;
|
58847
|
+
}
|
58848
|
+
const publicProperties = serializePropertySymbolsForClassOrInterface(
|
58849
|
+
publicSymbolProps,
|
58850
|
+
/*isClass*/
|
58851
|
+
true,
|
58852
|
+
baseTypes[0],
|
58335
58853
|
/*isStatic*/
|
58336
|
-
false
|
58337
|
-
|
58338
|
-
|
58339
|
-
const staticMembers = flatMap(
|
58854
|
+
false
|
58855
|
+
);
|
58856
|
+
const staticMembers = serializePropertySymbolsForClassOrInterface(
|
58340
58857
|
filter(getPropertiesOfType(staticType), (p) => !(p.flags & 4194304 /* Prototype */) && p.escapedName !== "prototype" && !isNamespaceMember(p)),
|
58341
|
-
|
58342
|
-
|
58343
|
-
|
58344
|
-
|
58345
|
-
|
58346
|
-
)
|
58858
|
+
/*isClass*/
|
58859
|
+
true,
|
58860
|
+
staticBaseType,
|
58861
|
+
/*isStatic*/
|
58862
|
+
true
|
58347
58863
|
);
|
58348
58864
|
const isNonConstructableClassLikeInJsFile = !isClass && !!symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && !some(getSignaturesOfType(staticType, 1 /* Construct */));
|
58865
|
+
if (isNonConstructableClassLikeInJsFile) context.approximateLength += 21;
|
58349
58866
|
const constructors = isNonConstructableClassLikeInJsFile ? [factory.createConstructorDeclaration(
|
58350
58867
|
factory.createModifiersFromModifierFlags(2 /* Private */),
|
58351
58868
|
[],
|
@@ -58413,6 +58930,8 @@ function createTypeChecker(host) {
|
|
58413
58930
|
if (((_b = (_a2 = node.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 260 /* VariableDeclaration */) {
|
58414
58931
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
58415
58932
|
const { propertyName } = node;
|
58933
|
+
const propertyNameText = propertyName && isIdentifier(propertyName) ? idText(propertyName) : void 0;
|
58934
|
+
context.approximateLength += 24 + localName.length + specifier2.length + ((propertyNameText == null ? void 0 : propertyNameText.length) ?? 0);
|
58416
58935
|
addResult(
|
58417
58936
|
factory.createImportDeclaration(
|
58418
58937
|
/*modifiers*/
|
@@ -58425,7 +58944,7 @@ function createTypeChecker(host) {
|
|
58425
58944
|
factory.createNamedImports([factory.createImportSpecifier(
|
58426
58945
|
/*isTypeOnly*/
|
58427
58946
|
false,
|
58428
|
-
|
58947
|
+
propertyNameText ? factory.createIdentifier(propertyNameText) : void 0,
|
58429
58948
|
factory.createIdentifier(localName)
|
58430
58949
|
)])
|
58431
58950
|
),
|
@@ -58452,6 +58971,7 @@ function createTypeChecker(host) {
|
|
58452
58971
|
const initializer = node.initializer;
|
58453
58972
|
const uniqueName = factory.createUniqueName(localName);
|
58454
58973
|
const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context);
|
58974
|
+
context.approximateLength += 22 + specifier2.length + idText(uniqueName).length;
|
58455
58975
|
addResult(
|
58456
58976
|
factory.createImportEqualsDeclaration(
|
58457
58977
|
/*modifiers*/
|
@@ -58463,6 +58983,7 @@ function createTypeChecker(host) {
|
|
58463
58983
|
),
|
58464
58984
|
0 /* None */
|
58465
58985
|
);
|
58986
|
+
context.approximateLength += 12 + localName.length + idText(uniqueName).length + idText(initializer.name).length;
|
58466
58987
|
addResult(
|
58467
58988
|
factory.createImportEqualsDeclaration(
|
58468
58989
|
/*modifiers*/
|
@@ -58483,6 +59004,7 @@ function createTypeChecker(host) {
|
|
58483
59004
|
break;
|
58484
59005
|
}
|
58485
59006
|
const isLocalImport = !(target.flags & 512 /* ValueModule */) && !isVariableDeclaration(node);
|
59007
|
+
context.approximateLength += 11 + localName.length + unescapeLeadingUnderscores(target.escapedName).length;
|
58486
59008
|
addResult(
|
58487
59009
|
factory.createImportEqualsDeclaration(
|
58488
59010
|
/*modifiers*/
|
@@ -58509,6 +59031,7 @@ function createTypeChecker(host) {
|
|
58509
59031
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier;
|
58510
59032
|
const attributes = isImportDeclaration(node.parent) ? node.parent.attributes : void 0;
|
58511
59033
|
const isTypeOnly = isJSDocImportTag(node.parent);
|
59034
|
+
context.approximateLength += 14 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
58512
59035
|
addResult(
|
58513
59036
|
factory.createImportDeclaration(
|
58514
59037
|
/*modifiers*/
|
@@ -58530,6 +59053,7 @@ function createTypeChecker(host) {
|
|
58530
59053
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
58531
59054
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier;
|
58532
59055
|
const isTypeOnly = isJSDocImportTag(node.parent.parent);
|
59056
|
+
context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
58533
59057
|
addResult(
|
58534
59058
|
factory.createImportDeclaration(
|
58535
59059
|
/*modifiers*/
|
@@ -58548,6 +59072,7 @@ function createTypeChecker(host) {
|
|
58548
59072
|
break;
|
58549
59073
|
}
|
58550
59074
|
case 280 /* NamespaceExport */:
|
59075
|
+
context.approximateLength += 19 + localName.length + 3;
|
58551
59076
|
addResult(
|
58552
59077
|
factory.createExportDeclaration(
|
58553
59078
|
/*modifiers*/
|
@@ -58564,6 +59089,7 @@ function createTypeChecker(host) {
|
|
58564
59089
|
const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context);
|
58565
59090
|
const specifier2 = context.bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier;
|
58566
59091
|
const isTypeOnly = isJSDocImportTag(node.parent.parent.parent);
|
59092
|
+
context.approximateLength += 19 + localName.length + 3 + (isTypeOnly ? 4 : 0);
|
58567
59093
|
addResult(
|
58568
59094
|
factory.createImportDeclaration(
|
58569
59095
|
/*modifiers*/
|
@@ -58619,6 +59145,7 @@ function createTypeChecker(host) {
|
|
58619
59145
|
}
|
58620
59146
|
}
|
58621
59147
|
function serializeExportSpecifier(localName, targetName, specifier) {
|
59148
|
+
context.approximateLength += 16 + localName.length + (localName !== targetName ? targetName.length : 0);
|
58622
59149
|
addResult(
|
58623
59150
|
factory.createExportDeclaration(
|
58624
59151
|
/*modifiers*/
|
@@ -58669,6 +59196,7 @@ function createTypeChecker(host) {
|
|
58669
59196
|
const prevDisableTrackSymbol = context.tracker.disableTrackSymbol;
|
58670
59197
|
context.tracker.disableTrackSymbol = true;
|
58671
59198
|
if (isExportAssignmentCompatibleSymbolName) {
|
59199
|
+
context.approximateLength += 10;
|
58672
59200
|
results.push(factory.createExportAssignment(
|
58673
59201
|
/*modifiers*/
|
58674
59202
|
void 0,
|
@@ -58682,6 +59210,7 @@ function createTypeChecker(host) {
|
|
58682
59210
|
serializeExportSpecifier(name, getInternalSymbolName(target, symbolName(target)));
|
58683
59211
|
} else {
|
58684
59212
|
const varName = getUnusedName(name, symbol);
|
59213
|
+
context.approximateLength += varName.length + 10;
|
58685
59214
|
addResult(
|
58686
59215
|
factory.createImportEqualsDeclaration(
|
58687
59216
|
/*modifiers*/
|
@@ -58711,6 +59240,7 @@ function createTypeChecker(host) {
|
|
58711
59240
|
serializeAsFunctionNamespaceMerge(typeToSerialize, symbol, varName, isExportAssignmentCompatibleSymbolName ? 0 /* None */ : 32 /* Export */);
|
58712
59241
|
} else {
|
58713
59242
|
const flags = ((_a2 = context.enclosingDeclaration) == null ? void 0 : _a2.kind) === 267 /* ModuleDeclaration */ && (!(symbol.flags & 98304 /* Accessor */) || symbol.flags & 65536 /* SetAccessor */) ? 1 /* Let */ : 2 /* Const */;
|
59243
|
+
context.approximateLength += varName.length + 5;
|
58714
59244
|
const statement = factory.createVariableStatement(
|
58715
59245
|
/*modifiers*/
|
58716
59246
|
void 0,
|
@@ -58735,6 +59265,7 @@ function createTypeChecker(host) {
|
|
58735
59265
|
);
|
58736
59266
|
}
|
58737
59267
|
if (isExportAssignmentCompatibleSymbolName) {
|
59268
|
+
context.approximateLength += varName.length + 10;
|
58738
59269
|
results.push(factory.createExportAssignment(
|
58739
59270
|
/*modifiers*/
|
58740
59271
|
void 0,
|
@@ -58769,7 +59300,7 @@ function createTypeChecker(host) {
|
|
58769
59300
|
return function serializePropertySymbol(p, isStatic2, baseType) {
|
58770
59301
|
var _a2, _b, _c, _d, _e, _f;
|
58771
59302
|
const modifierFlags = getDeclarationModifierFlagsFromSymbol(p);
|
58772
|
-
const
|
59303
|
+
const omitType = !!(modifierFlags & 2 /* Private */) && !isExpanding(context);
|
58773
59304
|
if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) {
|
58774
59305
|
return [];
|
58775
59306
|
}
|
@@ -58798,6 +59329,7 @@ function createTypeChecker(host) {
|
|
58798
59329
|
Debug.assert(!!setter);
|
58799
59330
|
const paramSymbol = isFunctionLikeDeclaration(setter) ? getSignatureFromDeclaration(setter).parameters[0] : void 0;
|
58800
59331
|
const setterDeclaration = (_b = p.declarations) == null ? void 0 : _b.find(isSetAccessor);
|
59332
|
+
context.approximateLength += modifiersLength(flag) + 7 + (paramSymbol ? symbolName(paramSymbol).length : 5) + (omitType ? 0 : 2);
|
58801
59333
|
result.push(setTextRange2(
|
58802
59334
|
context,
|
58803
59335
|
factory.createSetAccessorDeclaration(
|
@@ -58811,7 +59343,7 @@ function createTypeChecker(host) {
|
|
58811
59343
|
paramSymbol ? parameterToParameterDeclarationName(paramSymbol, getEffectiveParameterDeclaration(paramSymbol), context) : "value",
|
58812
59344
|
/*questionToken*/
|
58813
59345
|
void 0,
|
58814
|
-
|
59346
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, setterDeclaration, getWriteTypeOfSymbol(p), p)
|
58815
59347
|
)],
|
58816
59348
|
/*body*/
|
58817
59349
|
void 0
|
@@ -58820,15 +59352,15 @@ function createTypeChecker(host) {
|
|
58820
59352
|
));
|
58821
59353
|
}
|
58822
59354
|
if (p.flags & 32768 /* GetAccessor */) {
|
58823
|
-
const isPrivate2 = modifierFlags & 2 /* Private */;
|
58824
59355
|
const getterDeclaration = (_c = p.declarations) == null ? void 0 : _c.find(isGetAccessor);
|
59356
|
+
context.approximateLength += modifiersLength(flag) + 8 + (omitType ? 0 : 2);
|
58825
59357
|
result.push(setTextRange2(
|
58826
59358
|
context,
|
58827
59359
|
factory.createGetAccessorDeclaration(
|
58828
59360
|
factory.createModifiersFromModifierFlags(flag),
|
58829
59361
|
name,
|
58830
59362
|
[],
|
58831
|
-
|
59363
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, getterDeclaration, getTypeOfSymbol(p), p),
|
58832
59364
|
/*body*/
|
58833
59365
|
void 0
|
58834
59366
|
),
|
@@ -58837,13 +59369,15 @@ function createTypeChecker(host) {
|
|
58837
59369
|
}
|
58838
59370
|
return result;
|
58839
59371
|
} else if (p.flags & (4 /* Property */ | 3 /* Variable */ | 98304 /* Accessor */)) {
|
59372
|
+
const modifierFlags2 = (isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag;
|
59373
|
+
context.approximateLength += 2 + (omitType ? 0 : 2) + modifiersLength(modifierFlags2);
|
58840
59374
|
return setTextRange2(
|
58841
59375
|
context,
|
58842
59376
|
createProperty2(
|
58843
|
-
factory.createModifiersFromModifierFlags(
|
59377
|
+
factory.createModifiersFromModifierFlags(modifierFlags2),
|
58844
59378
|
name,
|
58845
59379
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
58846
|
-
|
59380
|
+
omitType ? void 0 : serializeTypeForDeclaration(context, (_d = p.declarations) == null ? void 0 : _d.find(isSetAccessorDeclaration), getWriteTypeOfSymbol(p), p),
|
58847
59381
|
// TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357
|
58848
59382
|
// interface members can't have initializers, however class members _can_
|
58849
59383
|
/*initializer*/
|
@@ -58855,11 +59389,13 @@ function createTypeChecker(host) {
|
|
58855
59389
|
if (p.flags & (8192 /* Method */ | 16 /* Function */)) {
|
58856
59390
|
const type = getTypeOfSymbol(p);
|
58857
59391
|
const signatures = getSignaturesOfType(type, 0 /* Call */);
|
58858
|
-
if (
|
59392
|
+
if (omitType) {
|
59393
|
+
const modifierFlags2 = (isReadonlySymbol(p) ? 8 /* Readonly */ : 0) | flag;
|
59394
|
+
context.approximateLength += 1 + modifiersLength(modifierFlags2);
|
58859
59395
|
return setTextRange2(
|
58860
59396
|
context,
|
58861
59397
|
createProperty2(
|
58862
|
-
factory.createModifiersFromModifierFlags(
|
59398
|
+
factory.createModifiersFromModifierFlags(modifierFlags2),
|
58863
59399
|
name,
|
58864
59400
|
p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
|
58865
59401
|
/*type*/
|
@@ -58872,6 +59408,7 @@ function createTypeChecker(host) {
|
|
58872
59408
|
}
|
58873
59409
|
const results2 = [];
|
58874
59410
|
for (const sig of signatures) {
|
59411
|
+
context.approximateLength += 1;
|
58875
59412
|
const decl = signatureToSignatureDeclarationHelper(
|
58876
59413
|
sig,
|
58877
59414
|
methodKind,
|
@@ -58890,6 +59427,25 @@ function createTypeChecker(host) {
|
|
58890
59427
|
return Debug.fail(`Unhandled class member kind! ${p.__debugFlags || p.flags}`);
|
58891
59428
|
};
|
58892
59429
|
}
|
59430
|
+
function modifiersLength(flags) {
|
59431
|
+
let result = 0;
|
59432
|
+
if (flags & 32 /* Export */) result += 7;
|
59433
|
+
if (flags & 128 /* Ambient */) result += 8;
|
59434
|
+
if (flags & 2048 /* Default */) result += 8;
|
59435
|
+
if (flags & 4096 /* Const */) result += 6;
|
59436
|
+
if (flags & 1 /* Public */) result += 7;
|
59437
|
+
if (flags & 2 /* Private */) result += 8;
|
59438
|
+
if (flags & 4 /* Protected */) result += 10;
|
59439
|
+
if (flags & 64 /* Abstract */) result += 9;
|
59440
|
+
if (flags & 256 /* Static */) result += 7;
|
59441
|
+
if (flags & 16 /* Override */) result += 9;
|
59442
|
+
if (flags & 8 /* Readonly */) result += 9;
|
59443
|
+
if (flags & 512 /* Accessor */) result += 9;
|
59444
|
+
if (flags & 1024 /* Async */) result += 6;
|
59445
|
+
if (flags & 8192 /* In */) result += 3;
|
59446
|
+
if (flags & 16384 /* Out */) result += 4;
|
59447
|
+
return result;
|
59448
|
+
}
|
58893
59449
|
function serializePropertySymbolForInterface(p, baseType) {
|
58894
59450
|
return serializePropertySymbolForInterfaceWorker(
|
58895
59451
|
p,
|
@@ -58954,6 +59510,7 @@ function createTypeChecker(host) {
|
|
58954
59510
|
}
|
58955
59511
|
const results2 = [];
|
58956
59512
|
for (const sig of signatures) {
|
59513
|
+
context.approximateLength += 1;
|
58957
59514
|
const decl = signatureToSignatureDeclarationHelper(sig, outputKind, context);
|
58958
59515
|
results2.push(setTextRange2(context, decl, sig.declaration));
|
58959
59516
|
}
|
@@ -59079,6 +59636,23 @@ function createTypeChecker(host) {
|
|
59079
59636
|
return localName;
|
59080
59637
|
}
|
59081
59638
|
}
|
59639
|
+
function isExpanding(context) {
|
59640
|
+
return context.maxExpansionDepth !== -1;
|
59641
|
+
}
|
59642
|
+
function isHashPrivate(s) {
|
59643
|
+
return !!s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name);
|
59644
|
+
}
|
59645
|
+
function getClonedHashPrivateName(s) {
|
59646
|
+
if (s.valueDeclaration && isNamedDeclaration(s.valueDeclaration) && isPrivateIdentifier(s.valueDeclaration.name)) {
|
59647
|
+
return factory.cloneNode(s.valueDeclaration.name);
|
59648
|
+
}
|
59649
|
+
return void 0;
|
59650
|
+
}
|
59651
|
+
}
|
59652
|
+
function isLibType(type) {
|
59653
|
+
var _a;
|
59654
|
+
const symbol = (getObjectFlags(type) & 4 /* Reference */) !== 0 ? type.target.symbol : type.symbol;
|
59655
|
+
return isTupleType(type) || !!((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.some((decl) => host.isSourceFileDefaultLibrary(getSourceFileOfNode(decl))));
|
59082
59656
|
}
|
59083
59657
|
function typePredicateToString(typePredicate, enclosingDeclaration, flags = 16384 /* UseAliasDefinedOutsideCurrentScope */, writer) {
|
59084
59658
|
return writer ? typePredicateToStringWorker(writer).getText() : usingSingleLineStringWriter(typePredicateToStringWorker);
|
@@ -59097,14 +59671,14 @@ function createTypeChecker(host) {
|
|
59097
59671
|
return writer2;
|
59098
59672
|
}
|
59099
59673
|
}
|
59100
|
-
function formatUnionTypes(types) {
|
59674
|
+
function formatUnionTypes(types, expandingEnum) {
|
59101
59675
|
const result = [];
|
59102
59676
|
let flags = 0;
|
59103
59677
|
for (let i = 0; i < types.length; i++) {
|
59104
59678
|
const t = types[i];
|
59105
59679
|
flags |= t.flags;
|
59106
59680
|
if (!(t.flags & 98304 /* Nullable */)) {
|
59107
|
-
if (t.flags &
|
59681
|
+
if (t.flags & 512 /* BooleanLiteral */ || !expandingEnum && t.flags | 1056 /* EnumLike */) {
|
59108
59682
|
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
59109
59683
|
if (baseType.flags & 1048576 /* Union */) {
|
59110
59684
|
const count = baseType.types.length;
|
@@ -63187,7 +63761,7 @@ function createTypeChecker(host) {
|
|
63187
63761
|
let hasThisParameter2 = false;
|
63188
63762
|
const iife = getImmediatelyInvokedFunctionExpression(declaration);
|
63189
63763
|
const isJSConstructSignature = isJSDocConstructSignature(declaration);
|
63190
|
-
const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
|
63764
|
+
const isUntypedSignatureInJSFile = !iife && isInJSFile(declaration) && isValueSignatureDeclaration(declaration) && !hasJSDocParameterTags(declaration) && !some(declaration.parameters, (p) => !!getJSDocType(p)) && !getJSDocType(declaration) && !getContextualSignatureForFunctionLikeDeclaration(declaration);
|
63191
63765
|
if (isUntypedSignatureInJSFile) {
|
63192
63766
|
flags |= 32 /* IsUntypedSignatureInJSFile */;
|
63193
63767
|
}
|
@@ -92049,6 +92623,9 @@ function createTypeChecker(host) {
|
|
92049
92623
|
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
92050
92624
|
}
|
92051
92625
|
}
|
92626
|
+
},
|
92627
|
+
symbolToDeclarations: (symbol, meaning, flags, verbosityLevel, out) => {
|
92628
|
+
return nodeBuilder.symbolToDeclarations(symbol, meaning, flags, verbosityLevel, out);
|
92052
92629
|
}
|
92053
92630
|
};
|
92054
92631
|
function isImportRequiredByAugmentation(node) {
|
@@ -120145,7 +120722,8 @@ var notImplementedResolver = {
|
|
120145
120722
|
getDeclarationStatementsForSourceFile: notImplemented,
|
120146
120723
|
isImportRequiredByAugmentation: notImplemented,
|
120147
120724
|
isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
|
120148
|
-
createLateBoundIndexSignatures: notImplemented
|
120725
|
+
createLateBoundIndexSignatures: notImplemented,
|
120726
|
+
symbolToDeclarations: notImplemented
|
120149
120727
|
};
|
120150
120728
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
120151
120729
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
@@ -140280,9 +140858,9 @@ function mapToDisplayParts(writeDisplayParts) {
|
|
140280
140858
|
displayPartWriter.clear();
|
140281
140859
|
}
|
140282
140860
|
}
|
140283
|
-
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None
|
140861
|
+
function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None */, verbosityLevel, out) {
|
140284
140862
|
return mapToDisplayParts((writer) => {
|
140285
|
-
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer);
|
140863
|
+
typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer, verbosityLevel, out);
|
140286
140864
|
});
|
140287
140865
|
}
|
140288
140866
|
function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags = 0 /* None */) {
|
@@ -140290,7 +140868,7 @@ function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning
|
|
140290
140868
|
typeChecker.writeSymbol(symbol, enclosingDeclaration, meaning, flags | 8 /* UseAliasDefinedOutsideCurrentScope */, writer);
|
140291
140869
|
});
|
140292
140870
|
}
|
140293
|
-
function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags = 0 /* None
|
140871
|
+
function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags = 0 /* None */, verbosityLevel, out) {
|
140294
140872
|
flags |= 16384 /* UseAliasDefinedOutsideCurrentScope */ | 1024 /* MultilineObjectLiterals */ | 32 /* WriteTypeArgumentsOfSignature */ | 8192 /* OmitParameterModifiers */;
|
140295
140873
|
return mapToDisplayParts((writer) => {
|
140296
140874
|
typechecker.writeSignature(
|
@@ -140299,7 +140877,9 @@ function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, f
|
|
140299
140877
|
flags,
|
140300
140878
|
/*kind*/
|
140301
140879
|
void 0,
|
140302
|
-
writer
|
140880
|
+
writer,
|
140881
|
+
verbosityLevel,
|
140882
|
+
out
|
140303
140883
|
);
|
140304
140884
|
});
|
140305
140885
|
}
|
@@ -140338,74 +140918,6 @@ function getPrecedingNonSpaceCharacterPosition(text, position) {
|
|
140338
140918
|
}
|
140339
140919
|
return position + 1;
|
140340
140920
|
}
|
140341
|
-
function getSynthesizedDeepClone(node, includeTrivia = true) {
|
140342
|
-
const clone2 = node && getSynthesizedDeepCloneWorker(node);
|
140343
|
-
if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
|
140344
|
-
return setParentRecursive(
|
140345
|
-
clone2,
|
140346
|
-
/*incremental*/
|
140347
|
-
false
|
140348
|
-
);
|
140349
|
-
}
|
140350
|
-
function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) {
|
140351
|
-
let clone2 = replaceNode(node);
|
140352
|
-
if (clone2) {
|
140353
|
-
setOriginalNode(clone2, node);
|
140354
|
-
} else {
|
140355
|
-
clone2 = getSynthesizedDeepCloneWorker(node, replaceNode);
|
140356
|
-
}
|
140357
|
-
if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
|
140358
|
-
return clone2;
|
140359
|
-
}
|
140360
|
-
function getSynthesizedDeepCloneWorker(node, replaceNode) {
|
140361
|
-
const nodeClone = replaceNode ? (n) => getSynthesizedDeepCloneWithReplacements(
|
140362
|
-
n,
|
140363
|
-
/*includeTrivia*/
|
140364
|
-
true,
|
140365
|
-
replaceNode
|
140366
|
-
) : getSynthesizedDeepClone;
|
140367
|
-
const nodesClone = replaceNode ? (ns) => ns && getSynthesizedDeepClonesWithReplacements(
|
140368
|
-
ns,
|
140369
|
-
/*includeTrivia*/
|
140370
|
-
true,
|
140371
|
-
replaceNode
|
140372
|
-
) : (ns) => ns && getSynthesizedDeepClones(ns);
|
140373
|
-
const visited = visitEachChild(
|
140374
|
-
node,
|
140375
|
-
nodeClone,
|
140376
|
-
/*context*/
|
140377
|
-
void 0,
|
140378
|
-
nodesClone,
|
140379
|
-
nodeClone
|
140380
|
-
);
|
140381
|
-
if (visited === node) {
|
140382
|
-
const clone2 = isStringLiteral(node) ? setOriginalNode(factory.createStringLiteralFromNode(node), node) : isNumericLiteral(node) ? setOriginalNode(factory.createNumericLiteral(node.text, node.numericLiteralFlags), node) : factory.cloneNode(node);
|
140383
|
-
return setTextRange(clone2, node);
|
140384
|
-
}
|
140385
|
-
visited.parent = void 0;
|
140386
|
-
return visited;
|
140387
|
-
}
|
140388
|
-
function getSynthesizedDeepClones(nodes, includeTrivia = true) {
|
140389
|
-
if (nodes) {
|
140390
|
-
const cloned = factory.createNodeArray(nodes.map((n) => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma);
|
140391
|
-
setTextRange(cloned, nodes);
|
140392
|
-
return cloned;
|
140393
|
-
}
|
140394
|
-
return nodes;
|
140395
|
-
}
|
140396
|
-
function getSynthesizedDeepClonesWithReplacements(nodes, includeTrivia, replaceNode) {
|
140397
|
-
return factory.createNodeArray(nodes.map((n) => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma);
|
140398
|
-
}
|
140399
|
-
function suppressLeadingAndTrailingTrivia(node) {
|
140400
|
-
suppressLeadingTrivia(node);
|
140401
|
-
suppressTrailingTrivia(node);
|
140402
|
-
}
|
140403
|
-
function suppressLeadingTrivia(node) {
|
140404
|
-
addEmitFlagsRecursively(node, 1024 /* NoLeadingComments */, getFirstChild);
|
140405
|
-
}
|
140406
|
-
function suppressTrailingTrivia(node) {
|
140407
|
-
addEmitFlagsRecursively(node, 2048 /* NoTrailingComments */, getLastChild);
|
140408
|
-
}
|
140409
140921
|
function copyComments(sourceNode, targetNode) {
|
140410
140922
|
const sourceFile = sourceNode.getSourceFile();
|
140411
140923
|
const text = sourceFile.text;
|
@@ -140424,14 +140936,6 @@ function hasLeadingLineBreak(node, text) {
|
|
140424
140936
|
}
|
140425
140937
|
return false;
|
140426
140938
|
}
|
140427
|
-
function addEmitFlagsRecursively(node, flag, getChild) {
|
140428
|
-
addEmitFlags(node, flag);
|
140429
|
-
const child = getChild(node);
|
140430
|
-
if (child) addEmitFlagsRecursively(child, flag, getChild);
|
140431
|
-
}
|
140432
|
-
function getFirstChild(node) {
|
140433
|
-
return node.forEachChild((child) => child);
|
140434
|
-
}
|
140435
140939
|
function getUniqueName(baseName, sourceFile) {
|
140436
140940
|
let nameText = baseName;
|
140437
140941
|
for (let i = 1; !isFileLevelUniqueName(sourceFile, nameText); i++) {
|
@@ -152248,7 +152752,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
152248
152752
|
synchronizeHostData();
|
152249
152753
|
return ts_Completions_exports.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences);
|
152250
152754
|
}
|
152251
|
-
function getQuickInfoAtPosition(fileName, position) {
|
152755
|
+
function getQuickInfoAtPosition(fileName, position, verbosityLevel) {
|
152252
152756
|
synchronizeHostData();
|
152253
152757
|
const sourceFile = getValidSourceFile(fileName);
|
152254
152758
|
const node = getTouchingPropertyName(sourceFile, position);
|
@@ -152264,19 +152768,41 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
152264
152768
|
kind: "" /* unknown */,
|
152265
152769
|
kindModifiers: "" /* none */,
|
152266
152770
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
152267
|
-
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
|
152771
|
+
displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
|
152772
|
+
typeChecker2,
|
152773
|
+
type,
|
152774
|
+
getContainerNode(nodeForQuickInfo),
|
152775
|
+
/*flags*/
|
152776
|
+
void 0,
|
152777
|
+
verbosityLevel
|
152778
|
+
)),
|
152268
152779
|
documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : void 0,
|
152269
152780
|
tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : void 0
|
152270
152781
|
};
|
152271
152782
|
}
|
152272
|
-
const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(
|
152783
|
+
const { symbolKind, displayParts, documentation, tags, canIncreaseVerbosityLevel } = typeChecker.runWithCancellationToken(
|
152784
|
+
cancellationToken,
|
152785
|
+
(typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(
|
152786
|
+
typeChecker2,
|
152787
|
+
symbol,
|
152788
|
+
sourceFile,
|
152789
|
+
getContainerNode(nodeForQuickInfo),
|
152790
|
+
nodeForQuickInfo,
|
152791
|
+
/*semanticMeaning*/
|
152792
|
+
void 0,
|
152793
|
+
/*alias*/
|
152794
|
+
void 0,
|
152795
|
+
verbosityLevel
|
152796
|
+
)
|
152797
|
+
);
|
152273
152798
|
return {
|
152274
152799
|
kind: symbolKind,
|
152275
152800
|
kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
|
152276
152801
|
textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
|
152277
152802
|
displayParts,
|
152278
152803
|
documentation,
|
152279
|
-
tags
|
152804
|
+
tags,
|
152805
|
+
canIncreaseVerbosityLevel
|
152280
152806
|
};
|
152281
152807
|
}
|
152282
152808
|
function preparePasteEditsForFile(fileName, copiedTextRange) {
|
@@ -177372,7 +177898,7 @@ function getSymbolModifiers(typeChecker, symbol) {
|
|
177372
177898
|
}
|
177373
177899
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
177374
177900
|
}
|
177375
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
177901
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias, verbosityLevel) {
|
177376
177902
|
var _a;
|
177377
177903
|
const displayParts = [];
|
177378
177904
|
let documentation = [];
|
@@ -177384,6 +177910,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177384
177910
|
let documentationFromAlias;
|
177385
177911
|
let tagsFromAlias;
|
177386
177912
|
let hasMultipleSignatures = false;
|
177913
|
+
const typeWriterOut = { canIncreaseExpansionDepth: false, truncated: false };
|
177914
|
+
let symbolWasExpanded = false;
|
177387
177915
|
if (location.kind === 110 /* ThisKeyword */ && !isThisExpression) {
|
177388
177916
|
return { displayParts: [keywordPart(110 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 };
|
177389
177917
|
}
|
@@ -177521,21 +178049,28 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177521
178049
|
}
|
177522
178050
|
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
|
177523
178051
|
addAliasPrefixIfNecessary();
|
177524
|
-
|
178052
|
+
const classExpression = getDeclarationOfKind(symbol, 231 /* ClassExpression */);
|
178053
|
+
if (classExpression) {
|
177525
178054
|
pushSymbolKind("local class" /* localClassElement */);
|
177526
|
-
|
177527
|
-
|
178055
|
+
displayParts.push(spacePart());
|
178056
|
+
}
|
178057
|
+
if (!tryExpandSymbol(symbol, semanticMeaning)) {
|
178058
|
+
if (!classExpression) {
|
178059
|
+
displayParts.push(keywordPart(86 /* ClassKeyword */));
|
178060
|
+
displayParts.push(spacePart());
|
178061
|
+
}
|
178062
|
+
addFullSymbolName(symbol);
|
178063
|
+
writeTypeParametersOfSymbol(symbol, sourceFile);
|
177528
178064
|
}
|
177529
|
-
displayParts.push(spacePart());
|
177530
|
-
addFullSymbolName(symbol);
|
177531
|
-
writeTypeParametersOfSymbol(symbol, sourceFile);
|
177532
178065
|
}
|
177533
178066
|
if (symbolFlags & 64 /* Interface */ && semanticMeaning & 2 /* Type */) {
|
177534
178067
|
prefixNextMeaning();
|
177535
|
-
|
177536
|
-
|
177537
|
-
|
177538
|
-
|
178068
|
+
if (!tryExpandSymbol(symbol, semanticMeaning)) {
|
178069
|
+
displayParts.push(keywordPart(120 /* InterfaceKeyword */));
|
178070
|
+
displayParts.push(spacePart());
|
178071
|
+
addFullSymbolName(symbol);
|
178072
|
+
writeTypeParametersOfSymbol(symbol, sourceFile);
|
178073
|
+
}
|
177539
178074
|
}
|
177540
178075
|
if (symbolFlags & 524288 /* TypeAlias */ && semanticMeaning & 2 /* Type */) {
|
177541
178076
|
prefixNextMeaning();
|
@@ -177546,25 +178081,43 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177546
178081
|
displayParts.push(spacePart());
|
177547
178082
|
displayParts.push(operatorPart(64 /* EqualsToken */));
|
177548
178083
|
displayParts.push(spacePart());
|
177549
|
-
addRange(
|
178084
|
+
addRange(
|
178085
|
+
displayParts,
|
178086
|
+
typeToDisplayParts(
|
178087
|
+
typeChecker,
|
178088
|
+
location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol),
|
178089
|
+
enclosingDeclaration,
|
178090
|
+
8388608 /* InTypeAlias */,
|
178091
|
+
verbosityLevel,
|
178092
|
+
typeWriterOut
|
178093
|
+
)
|
178094
|
+
);
|
177550
178095
|
}
|
177551
178096
|
if (symbolFlags & 384 /* Enum */) {
|
177552
178097
|
prefixNextMeaning();
|
177553
|
-
if (
|
177554
|
-
|
178098
|
+
if (!tryExpandSymbol(symbol, semanticMeaning)) {
|
178099
|
+
if (some(symbol.declarations, (d) => isEnumDeclaration(d) && isEnumConst(d))) {
|
178100
|
+
displayParts.push(keywordPart(87 /* ConstKeyword */));
|
178101
|
+
displayParts.push(spacePart());
|
178102
|
+
}
|
178103
|
+
displayParts.push(keywordPart(94 /* EnumKeyword */));
|
177555
178104
|
displayParts.push(spacePart());
|
178105
|
+
addFullSymbolName(
|
178106
|
+
symbol,
|
178107
|
+
/*enclosingDeclaration*/
|
178108
|
+
void 0
|
178109
|
+
);
|
177556
178110
|
}
|
177557
|
-
displayParts.push(keywordPart(94 /* EnumKeyword */));
|
177558
|
-
displayParts.push(spacePart());
|
177559
|
-
addFullSymbolName(symbol);
|
177560
178111
|
}
|
177561
178112
|
if (symbolFlags & 1536 /* Module */ && !isThisExpression) {
|
177562
178113
|
prefixNextMeaning();
|
177563
|
-
|
177564
|
-
|
177565
|
-
|
177566
|
-
|
177567
|
-
|
178114
|
+
if (!tryExpandSymbol(symbol, semanticMeaning)) {
|
178115
|
+
const declaration = getDeclarationOfKind(symbol, 267 /* ModuleDeclaration */);
|
178116
|
+
const isNamespace = declaration && declaration.name && declaration.name.kind === 80 /* Identifier */;
|
178117
|
+
displayParts.push(keywordPart(isNamespace ? 145 /* NamespaceKeyword */ : 144 /* ModuleKeyword */));
|
178118
|
+
displayParts.push(spacePart());
|
178119
|
+
addFullSymbolName(symbol);
|
178120
|
+
}
|
177568
178121
|
}
|
177569
178122
|
if (symbolFlags & 262144 /* TypeParameter */ && semanticMeaning & 2 /* Type */) {
|
177570
178123
|
prefixNextMeaning();
|
@@ -177634,12 +178187,16 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177634
178187
|
declarationName,
|
177635
178188
|
type,
|
177636
178189
|
semanticMeaning,
|
177637
|
-
shouldUseAliasName ? symbol : resolvedSymbol
|
178190
|
+
shouldUseAliasName ? symbol : resolvedSymbol,
|
178191
|
+
verbosityLevel
|
177638
178192
|
);
|
177639
178193
|
displayParts.push(...resolvedInfo.displayParts);
|
177640
178194
|
displayParts.push(lineBreakPart());
|
177641
178195
|
documentationFromAlias = resolvedInfo.documentation;
|
177642
178196
|
tagsFromAlias = resolvedInfo.tags;
|
178197
|
+
if (typeWriterOut && resolvedInfo.canIncreaseVerbosityLevel) {
|
178198
|
+
typeWriterOut.canIncreaseExpansionDepth = true;
|
178199
|
+
}
|
177643
178200
|
} else {
|
177644
178201
|
documentationFromAlias = resolvedSymbol.getContextualDocumentationComment(resolvedNode, typeChecker);
|
177645
178202
|
tagsFromAlias = resolvedSymbol.getJsDocTags(typeChecker);
|
@@ -177705,12 +178262,33 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177705
178262
|
displayParts.push(spacePart());
|
177706
178263
|
if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) {
|
177707
178264
|
const typeParameterParts = mapToDisplayParts((writer) => {
|
177708
|
-
const param = typeChecker.typeParameterToDeclaration(
|
178265
|
+
const param = typeChecker.typeParameterToDeclaration(
|
178266
|
+
type,
|
178267
|
+
enclosingDeclaration,
|
178268
|
+
symbolDisplayNodeBuilderFlags,
|
178269
|
+
/*internalFlags*/
|
178270
|
+
void 0,
|
178271
|
+
/*tracker*/
|
178272
|
+
void 0,
|
178273
|
+
verbosityLevel,
|
178274
|
+
typeWriterOut
|
178275
|
+
);
|
177709
178276
|
getPrinter().writeNode(4 /* Unspecified */, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
|
177710
178277
|
});
|
177711
178278
|
addRange(displayParts, typeParameterParts);
|
177712
178279
|
} else {
|
177713
|
-
addRange(
|
178280
|
+
addRange(
|
178281
|
+
displayParts,
|
178282
|
+
typeToDisplayParts(
|
178283
|
+
typeChecker,
|
178284
|
+
type,
|
178285
|
+
enclosingDeclaration,
|
178286
|
+
/*flags*/
|
178287
|
+
void 0,
|
178288
|
+
verbosityLevel,
|
178289
|
+
typeWriterOut
|
178290
|
+
)
|
178291
|
+
);
|
177714
178292
|
}
|
177715
178293
|
if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) {
|
177716
178294
|
const labelDecl = symbol.links.target.links.tupleLabelDeclaration;
|
@@ -177775,7 +178353,14 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177775
178353
|
if (tags.length === 0 && tagsFromAlias) {
|
177776
178354
|
tags = tagsFromAlias;
|
177777
178355
|
}
|
177778
|
-
|
178356
|
+
const canIncreaseVerbosityLevel = !typeWriterOut.truncated && typeWriterOut.canIncreaseExpansionDepth;
|
178357
|
+
return {
|
178358
|
+
displayParts,
|
178359
|
+
documentation,
|
178360
|
+
symbolKind,
|
178361
|
+
tags: tags.length === 0 ? void 0 : tags,
|
178362
|
+
canIncreaseVerbosityLevel: verbosityLevel !== void 0 ? canIncreaseVerbosityLevel : void 0
|
178363
|
+
};
|
177779
178364
|
function getPrinter() {
|
177780
178365
|
return createPrinterWithRemoveComments();
|
177781
178366
|
}
|
@@ -177796,6 +178381,62 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177796
178381
|
displayParts.push(keywordPart(103 /* InKeyword */));
|
177797
178382
|
displayParts.push(spacePart());
|
177798
178383
|
}
|
178384
|
+
function canExpandSymbol(symbol2, out) {
|
178385
|
+
if (verbosityLevel === void 0) {
|
178386
|
+
return false;
|
178387
|
+
}
|
178388
|
+
const type2 = symbol2.flags & (32 /* Class */ | 64 /* Interface */) ? typeChecker.getDeclaredTypeOfSymbol(symbol2) : typeChecker.getTypeOfSymbolAtLocation(symbol2, location);
|
178389
|
+
if (!type2 || typeChecker.isLibType(type2)) {
|
178390
|
+
return false;
|
178391
|
+
}
|
178392
|
+
if (0 < verbosityLevel) {
|
178393
|
+
return true;
|
178394
|
+
}
|
178395
|
+
if (out) {
|
178396
|
+
out.canIncreaseExpansionDepth = true;
|
178397
|
+
}
|
178398
|
+
return false;
|
178399
|
+
}
|
178400
|
+
function semanticToSymbolMeaning(meaning) {
|
178401
|
+
let symbolMeaning = 0 /* None */;
|
178402
|
+
if (meaning & 1 /* Value */) {
|
178403
|
+
symbolMeaning |= 111551 /* Value */;
|
178404
|
+
}
|
178405
|
+
if (meaning & 2 /* Type */) {
|
178406
|
+
symbolMeaning |= 788968 /* Type */;
|
178407
|
+
}
|
178408
|
+
if (meaning & 4 /* Namespace */) {
|
178409
|
+
symbolMeaning |= 1920 /* Namespace */;
|
178410
|
+
}
|
178411
|
+
return symbolMeaning;
|
178412
|
+
}
|
178413
|
+
function tryExpandSymbol(symbol2, meaning) {
|
178414
|
+
if (symbolWasExpanded) {
|
178415
|
+
return true;
|
178416
|
+
}
|
178417
|
+
if (canExpandSymbol(symbol2, typeWriterOut)) {
|
178418
|
+
const symbolMeaning = semanticToSymbolMeaning(meaning);
|
178419
|
+
const expandedDisplayParts = mapToDisplayParts((writer) => {
|
178420
|
+
const nodes = typeChecker.getEmitResolver().symbolToDeclarations(
|
178421
|
+
symbol2,
|
178422
|
+
symbolMeaning,
|
178423
|
+
1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */,
|
178424
|
+
verbosityLevel !== void 0 ? verbosityLevel - 1 : void 0,
|
178425
|
+
typeWriterOut
|
178426
|
+
);
|
178427
|
+
const printer = getPrinter();
|
178428
|
+
const sourceFile2 = symbol2.valueDeclaration && getSourceFileOfNode(symbol2.valueDeclaration);
|
178429
|
+
nodes.forEach((node, i) => {
|
178430
|
+
if (i > 0) writer.writeLine();
|
178431
|
+
printer.writeNode(4 /* Unspecified */, node, sourceFile2, writer);
|
178432
|
+
});
|
178433
|
+
});
|
178434
|
+
addRange(displayParts, expandedDisplayParts);
|
178435
|
+
symbolWasExpanded = true;
|
178436
|
+
return true;
|
178437
|
+
}
|
178438
|
+
return false;
|
178439
|
+
}
|
177799
178440
|
function addFullSymbolName(symbolToDisplay, enclosingDeclaration2) {
|
177800
178441
|
let indexInfos;
|
177801
178442
|
if (alias && symbolToDisplay === symbol) {
|
@@ -177863,7 +178504,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177863
178504
|
}
|
177864
178505
|
}
|
177865
178506
|
function addSignatureDisplayParts(signature, allSignatures, flags = 0 /* None */) {
|
177866
|
-
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature
|
178507
|
+
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */, verbosityLevel, typeWriterOut));
|
177867
178508
|
if (allSignatures.length > 1) {
|
177868
178509
|
displayParts.push(spacePart());
|
177869
178510
|
displayParts.push(punctuationPart(21 /* OpenParenToken */));
|
@@ -177888,7 +178529,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
177888
178529
|
addRange(displayParts, typeParameterParts);
|
177889
178530
|
}
|
177890
178531
|
}
|
177891
|
-
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
178532
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias, verbosityLevel) {
|
177892
178533
|
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
177893
178534
|
typeChecker,
|
177894
178535
|
symbol,
|
@@ -177898,7 +178539,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
|
|
177898
178539
|
/*type*/
|
177899
178540
|
void 0,
|
177900
178541
|
semanticMeaning,
|
177901
|
-
alias
|
178542
|
+
alias,
|
178543
|
+
verbosityLevel
|
177902
178544
|
);
|
177903
178545
|
}
|
177904
178546
|
function isLocalVariableOrFunction(symbol) {
|
@@ -194853,7 +195495,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
194853
195495
|
getQuickInfoWorker(args, simplifiedResult) {
|
194854
195496
|
const { file, project } = this.getFileAndProject(args);
|
194855
195497
|
const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
|
194856
|
-
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo));
|
195498
|
+
const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo), args.verbosityLevel);
|
194857
195499
|
if (!quickInfo) {
|
194858
195500
|
return void 0;
|
194859
195501
|
}
|
@@ -194867,7 +195509,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
194867
195509
|
end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)),
|
194868
195510
|
displayString,
|
194869
195511
|
documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation),
|
194870
|
-
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts)
|
195512
|
+
tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts),
|
195513
|
+
canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel
|
194871
195514
|
};
|
194872
195515
|
} else {
|
194873
195516
|
return useDisplayParts ? quickInfo : {
|