Skip to content

Commit 59c6123

Browse files
committed
Improved the way the Span algorithm models separators, to solve various spacing issues
1 parent 3ce8ad1 commit 59c6123

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎apps/api-extractor/src/generators/DtsGenerator.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ export default class DtsGenerator {
254254

255255
case ts.SyntaxKind.ExportKeyword:
256256
case ts.SyntaxKind.DefaultKeyword:
257+
case ts.SyntaxKind.DeclareKeyword:
257258
// Delete any explicit "export" keywords -- we will re-add them based on Entry.exported
258259
args.prefix = '';
259260
args.skipChildrenAndSuffix = true;
@@ -265,12 +266,7 @@ export default class DtsGenerator {
265266
case ts.SyntaxKind.EnumKeyword:
266267
case ts.SyntaxKind.NamespaceKeyword:
267268
case ts.SyntaxKind.TypeKeyword:
268-
if (args.previousSpan && args.previousSpan.node.kind === ts.SyntaxKind.SyntaxList) {
269-
args.skipSeparatorBefore = true;
270-
}
271-
272269
args.prefix = 'declare ' + args.prefix;
273-
274270
if (args.context.entry.exported) {
275271
args.prefix = 'export ' + args.prefix;
276272
}

0 commit comments

Comments
 (0)