Skip to content

Commit 73cfa64

Browse files
committed
Make sure not to truncate the stringified type from typeToString
1 parent b13de05 commit 73cfa64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/codefixes/fixJSDocTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ namespace ts.codefix {
1515
const jsdocType = (decl as VariableDeclaration).type;
1616
const original = getTextOfNode(jsdocType);
1717
const type = checker.getTypeFromTypeNode(jsdocType);
18-
const actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type))];
18+
const actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.NoTruncation))];
1919
if (jsdocType.kind === SyntaxKind.JSDocNullableType) {
2020
// for nullable types, suggest the flow-compatible `T | null | undefined`
2121
// in addition to the jsdoc/closure-compatible `T | null`
22-
const replacementWithUndefined = checker.typeToString(checker.getNullableType(type, TypeFlags.Undefined));
22+
const replacementWithUndefined = checker.typeToString(checker.getNullableType(type, TypeFlags.Undefined), /*enclosingDeclaration*/ undefined, TypeFormatFlags.NoTruncation);
2323
actions.push(createAction(jsdocType, sourceFile.fileName, original, replacementWithUndefined));
2424
}
2525
return actions;

0 commit comments

Comments
 (0)