Skip to content

Commit e2156a1

Browse files
authored
Add huge maximal length for noTruncation mode (microsoft#37461)
1 parent 237ea52 commit e2156a1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/compiler/checker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4010,7 +4010,7 @@ namespace ts {
40104010
printer.writeNode(EmitHint.Unspecified, typeNode, /*sourceFile*/ sourceFile, writer);
40114011
const result = writer.getText();
40124012

4013-
const maxLength = noTruncation ? undefined : defaultMaximumTruncationLength * 2;
4013+
const maxLength = noTruncation ? noTruncationMaximumTruncationLength * 2 : defaultMaximumTruncationLength * 2;
40144014
if (maxLength && result && result.length >= maxLength) {
40154015
return result.substr(0, maxLength - "...".length) + "...";
40164016
}
@@ -4083,7 +4083,7 @@ namespace ts {
40834083

40844084
function checkTruncationLength(context: NodeBuilderContext): boolean {
40854085
if (context.truncating) return context.truncating;
4086-
return context.truncating = !(context.flags & NodeBuilderFlags.NoTruncation) && context.approximateLength > defaultMaximumTruncationLength;
4086+
return context.truncating = context.approximateLength > ((context.flags & NodeBuilderFlags.NoTruncation) ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
40874087
}
40884088

40894089
function typeToTypeNodeHelper(type: Type, context: NodeBuilderContext): TypeNode {

src/compiler/utilities.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace ts {
77
export const externalHelpersModuleNameText = "tslib";
88

99
export const defaultMaximumTruncationLength = 160;
10+
export const noTruncationMaximumTruncationLength = 1_000_000;
1011

1112
export function getDeclarationOfKind<T extends Declaration>(symbol: Symbol, kind: T["kind"]): T | undefined {
1213
const declarations = symbol.declarations;

0 commit comments

Comments
 (0)