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 authored and benjamn committed Aug 23, 2020
1 parent 556d441 commit c2183d7
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 @@ -1906,7 +1906,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 @@ -271,6 +271,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 c2183d7

Please sign in to comment.