After defining a type in Typescript 3.8+ and attempting to export it:
type Type = { Prop: string };
export { Type }
An error message appears in VS Code:
When using the
--isolatedModules
flag, re-exporting a type requires usingexport type
To address this, I modified the code as per the error message:
type Type = { Prop: string };
export type { Type }
However, this adjustment led to another error flagged by eslint:
Parsing error: Declaration or statement expected.
I have two questions regarding this scenario:
- Why is this considered "re-exporting"?
- Is this form of export supported in Typescript 3.8+ with the
--isolatedModules
flag enabled, as mentioned here?