@@ -9731,20 +9731,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
97319731 i++;
97329732 if (checkUnfoldingTruncationLength(context) && (i + 2 < props.length - 1)) {
97339733 context.out.truncated = true;
9734- const placeholder = isClass ?
9735- factory.createPropertyDeclaration(
9736- /*modifiers*/ undefined,
9737- `... ${props.length - i} more ... `,
9738- /*questionOrExclamationToken*/ undefined,
9739- /*type*/ undefined,
9740- /*initializer*/ undefined,
9741- ) :
9742- factory.createPropertySignature(
9743- /*modifiers*/ undefined,
9744- `... ${props.length - i} more ... `,
9745- /*questionToken*/ undefined,
9746- /*type*/ undefined,
9747- );
9734+ const placeholder = createTruncationProperty(`... ${props.length - i} more ... `, isClass);
97489735 elements.push(placeholder);
97499736 const result = isClass ?
97509737 serializePropertySymbolForClass(props[props.length - 1], isStatic!, baseType) :
@@ -9772,6 +9759,26 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
97729759 return elements;
97739760 }
97749761
9762+ function createTruncationProperty(dotDotDotText: string, isClass: boolean): TypeElement | ClassElement {
9763+ if (context.flags & NodeBuilderFlags.NoTruncation) {
9764+ return addSyntheticLeadingComment(factory.createNotEmittedTypeElement(), SyntaxKind.MultiLineCommentTrivia, dotDotDotText);
9765+ }
9766+ return isClass ?
9767+ factory.createPropertyDeclaration(
9768+ /*modifiers*/ undefined,
9769+ dotDotDotText,
9770+ /*questionOrExclamationToken*/ undefined,
9771+ /*type*/ undefined,
9772+ /*initializer*/ undefined,
9773+ ) :
9774+ factory.createPropertySignature(
9775+ /*modifiers*/ undefined,
9776+ dotDotDotText,
9777+ /*questionToken*/ undefined,
9778+ /*type*/ undefined,
9779+ );
9780+ }
9781+
97759782 function getNamespaceMembersForSerialization(symbol: Symbol) {
97769783 let exports = arrayFrom(getExportsOfSymbol(symbol).values());
97779784 const merged = getMergedSymbol(symbol);
@@ -9891,7 +9898,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
98919898 initializer = initializedValue === undefined ? undefined :
98929899 typeof initializedValue === "string" ? factory.createStringLiteral(initializedValue) :
98939900 factory.createNumericLiteral(initializedValue);
9894- initializerLength = (initializer as StringLiteral | NumericLiteral | undefined)?.text.length ?? 0
9901+ initializerLength = (initializer as StringLiteral | NumericLiteral | undefined)?.text.length ?? 0;
98959902 }
98969903 const memberName = unescapeLeadingUnderscores(p.escapedName);
98979904 context.approximateLength += 4 + memberName.length + initializerLength; // `member = initializer,`
@@ -9928,6 +9935,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
99289935 }
99299936
99309937 function createTruncationStatement(dotDotDotText: string): Statement {
9938+ if (context.flags & NodeBuilderFlags.NoTruncation) {
9939+ return addSyntheticLeadingComment(factory.createEmptyStatement(), SyntaxKind.MultiLineCommentTrivia, dotDotDotText);
9940+ }
99319941 return factory.createExpressionStatement(factory.createIdentifier(dotDotDotText));
99329942 }
99339943
0 commit comments