diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index 78c5210b29c9..beb16568a1ee 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -2937,7 +2937,8 @@ function printPathNoParens(path, options, print, args) { "import(", path.call(print, "argument"), ")", - !n.qualifier ? "" : concat([".", path.call(print, "qualifier")]) + !n.qualifier ? "" : concat([".", path.call(print, "qualifier")]), + printTypeParameters(path, options, print, "typeParameters") ]); case "TSLiteralType": return path.call(print, "literal"); diff --git a/tests/typescript_import_type/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_import_type/__snapshots__/jsfmt.spec.js.snap index 387f8254c4eb..1c1c35c5888d 100644 --- a/tests/typescript_import_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_import_type/__snapshots__/jsfmt.spec.js.snap @@ -10,6 +10,10 @@ export let y: import("./foo2").Bar.I = { a: "", b: 0 }; export let shim: typeof import("./foo2") = { Bar: Bar2 }; + +export interface Foo { + bar: import('immutable').Map; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ref: https://github.com/Microsoft/TypeScript/pull/22592 @@ -21,6 +25,10 @@ export let shim: typeof import("./foo2") = { Bar: Bar2 }; +export interface Foo { + bar: import("immutable").Map; +} + `; exports[`import-type.ts 2`] = ` @@ -33,6 +41,10 @@ export let y: import("./foo2").Bar.I = { a: "", b: 0 }; export let shim: typeof import("./foo2") = { Bar: Bar2 }; + +export interface Foo { + bar: import('immutable').Map; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ref: https://github.com/Microsoft/TypeScript/pull/22592 @@ -44,4 +56,8 @@ export let shim: typeof import('./foo2') = { Bar: Bar2 }; +export interface Foo { + bar: import('immutable').Map; +} + `; diff --git a/tests/typescript_import_type/import-type.ts b/tests/typescript_import_type/import-type.ts index 3d7924e20157..d3c6db519282 100644 --- a/tests/typescript_import_type/import-type.ts +++ b/tests/typescript_import_type/import-type.ts @@ -7,3 +7,7 @@ export let y: import("./foo2").Bar.I = { a: "", b: 0 }; export let shim: typeof import("./foo2") = { Bar: Bar2 }; + +export interface Foo { + bar: import('immutable').Map; +}