Skip to content

Commit

Permalink
Fix TSRestType printing
Browse files Browse the repository at this point in the history
Fixes #715
  • Loading branch information
conartist6 committed Jun 7, 2020
1 parent a961956 commit c68593e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ function genericPrintNoParens(path: any, options: any, print: any) {
return concat(['[', fromString(', ').join(path.map(print, 'elementTypes')), ']']);

case 'TSRestType':
return concat(['...', path.call(print, 'typeAnnotation'), '[]']);
return concat(['...', path.call(print, 'typeAnnotation')]);

case 'TSOptionalType':
return concat([path.call(print, 'typeAnnotation'), '?']);
Expand Down
2 changes: 2 additions & 0 deletions test/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ const nodeMajorVersion = parseInt(process.versions.node, 10);
check(['createPlugin<number>();']);

check(['type Class<T> = new (...args: any) => T;']);

check(['type T1 = [...Array<any>];', 'type T2 = [...any[]];']);
});

it('parens', function () {
Expand Down

0 comments on commit c68593e

Please sign in to comment.