diff --git a/src/printer.js b/src/printer.js index 71e96ec6c..95a4eadb0 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1918,7 +1918,17 @@ function genericPrintNoParens(path, options, print, args) { return concat(parts); case "TSTypeReference": - return concat([path.call(print, "typeName")]); + parts.push(path.call(print, "typeName")) + + if (n.typeArguments) { + parts.push( + "<", + join(", ", path.map(print, "typeArguments")), + ">" + ) + } + + return concat(parts); case "TSCallSignature": return concat([ "(", diff --git a/tests/typescript/conformance/types/typeReference/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/typeReference/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..bf1172a20 --- /dev/null +++ b/tests/typescript/conformance/types/typeReference/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typeReference.ts 1`] = ` +let n: Promise +let m: Map +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +let n: Promise; +let m: Map; + +`; diff --git a/tests/typescript/conformance/types/typeReference/jsfmt.spec.js b/tests/typescript/conformance/types/typeReference/jsfmt.spec.js new file mode 100644 index 000000000..bc085c48c --- /dev/null +++ b/tests/typescript/conformance/types/typeReference/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "typescript" }); diff --git a/tests/typescript/conformance/types/typeReference/typeReference.ts b/tests/typescript/conformance/types/typeReference/typeReference.ts new file mode 100644 index 000000000..2ae64e80c --- /dev/null +++ b/tests/typescript/conformance/types/typeReference/typeReference.ts @@ -0,0 +1,2 @@ +let n: Promise +let m: Map