Closed
Description
π Search Terms
export type invalid JavaScript
π Version & Regression Information
- This changed between versions 5.1 and 5.2
β― Playground Link
π» Code
import type { SomeType } from './type';
export { SomeType };
π Actual behavior
TypeScript will generate the following JS:
export { SomeType };
This JS is invalid since SomeType
is not defined. Basically the import type
is removed, but the export
of the type was not.
π Expected behavior
Type should be removed from export as in 5.1
Additional information about the issue
In the example above the source code has errors, so it could be argued that the output does not have to be valid. The issue was however discovered when using transpileModule
. transpileModule
similarly can't by design resolve the types and will preserve them in the output even though the types actually exist.
This is going to block us at Bloomberg from fully adopting TS 5.2 as we have workflows that depend on transpileModule