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