Elide import equals in transpileModule if referenced only by export type (#49664)

* Elide import equals in transpileModule if referenced only by export type.

* Revise approach to avoid marking alias in export type as referenced.

* Handle type only export specifier.
This commit is contained in:
Will Nayes
2022-07-05 09:08:43 -07:00
committed by GitHub
parent 3dbe62e3f0
commit 501e442ffc
6 changed files with 49 additions and 4 deletions
@@ -485,5 +485,19 @@ export { a as alias };
export * as alias from './file';`, {
noSetFileName: true
});
transpilesCorrectly("Elides import equals referenced only by export type",
`import IFoo = Namespace.IFoo;` +
`export type { IFoo };`, {
options: { compilerOptions: { module: ModuleKind.CommonJS } }
}
);
transpilesCorrectly("Elides import equals referenced only by type only export specifier",
`import IFoo = Namespace.IFoo;` +
`export { type IFoo };`, {
options: { compilerOptions: { module: ModuleKind.CommonJS } }
}
);
});
}