Prevent collision of imported type with exported declarations in current module by collin5 · Pull Request #31231 · microsoft/TypeScript (original) (raw)

I hate to be the https://xkcd.com/1172/ person but this is actually something I liberally use to work around --isolatedModules-related limitations when re-exporting types under the same name 🤣

// a.ts export interface A {}

// index.ts import { A } from './a' export type A = A

No big deal, it'll just take some, uh, intensive codemodding.


The best way of dealing with this and correctly be able to elide type-only reexports with --isolatedModules / @babel/preset-typescript would probably be to have an export { type A } from './a' syntax, à la Flow.