fix(typescript): add missing `qualifier` and `typeof` in TSImportType (#4438)

master
Ika 2018-05-08 12:35:12 +08:00 committed by GitHub
parent c6e7c1966e
commit 76a5f3c7b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -2881,7 +2881,13 @@ function printPathNoParens(path, options, print, args) {
case "TSThisType":
return "this";
case "TSLastTypeNode": // TSImportType
return concat(["import(", path.call(print, "argument"), ")"]);
return concat([
!n.isTypeOf ? "" : "typeof ",
"import(",
path.call(print, "argument"),
")",
!n.qualifier ? "" : concat([".", path.call(print, "qualifier")])
]);
case "TSLiteralType":
return path.call(print, "literal");
case "TSIndexedAccessType":

View File

@ -15,9 +15,9 @@ export let shim: typeof import("./foo2") = {
export const x: import("./foo") = { x: 0, y: 0 };
export let y: import("./foo2") = { a: "", b: 0 };
export let y: import("./foo2").Bar.I = { a: "", b: 0 };
export let shim: import("./foo2") = {
export let shim: typeof import("./foo2") = {
Bar: Bar2
};
@ -38,9 +38,9 @@ export let shim: typeof import("./foo2") = {
export const x: import('./foo') = { x: 0, y: 0 };
export let y: import('./foo2') = { a: '', b: 0 };
export let y: import('./foo2').Bar.I = { a: '', b: 0 };
export let shim: import('./foo2') = {
export let shim: typeof import('./foo2') = {
Bar: Bar2
};