Skip to content

Commit

Permalink
Release 3.2.5; Fix namespace comment (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit committed Jun 14, 2022
1 parent 54e5607 commit 39e2e76
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tfig",
"version": "3.2.4",
"version": "3.2.5",
"description": "Yet another tool to generate .d.ts bundle.",
"main": "build/gift.js",
"types": "build/gift.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions source/recast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ export function recastTopLevelModule({
nodeFactor.createModuleBlock(childrenEntityStatements),
ts.NodeFlags.Namespace,
);
const declaration0 = declarations[0];
if (declaration0.kind === ts.SyntaxKind.ModuleDeclaration) {
copyComments(declaration0, namespaceDeclaration);
}
statements.push(namespaceDeclaration);
}
return statements;
Expand Down
4 changes: 4 additions & 0 deletions test/comments/__snapshots__/comments.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ exports[`Type alias 1`] = `
export class Bar {
}
}
/**
* Namespace2.
*/
export namespace Ns { }
export {};
}
"
Expand Down
6 changes: 6 additions & 0 deletions test/comments/input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ declare module "foo" {
* Namespace.
*/
export * as bar from 'bar';

/**
* Namespace2.
*/
export namespace Ns {
}
}

declare module "bar" {
Expand Down

0 comments on commit 39e2e76

Please sign in to comment.