Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not erasure types #863

Closed
CHOYSEN opened this issue Feb 21, 2021 · 3 comments
Closed

Can not erasure types #863

CHOYSEN opened this issue Feb 21, 2021 · 3 comments

Comments

@CHOYSEN
Copy link

CHOYSEN commented Feb 21, 2021

Reproduction

https://github.com/CHOYSEN/esbuild-types-issue

b.ts export interface Car
a.ts import Car then export it, should it be erasure?
It works as my expect when a.ts doesn't export Car

@CHOYSEN
Copy link
Author

CHOYSEN commented Feb 21, 2021

The original issue vitejs/vite#2117

@evanw
Copy link
Owner

evanw commented Feb 21, 2021

From the documentation:

You should probably enable the isolatedModules TypeScript configuration option if you use TypeScript with esbuild. This prevents you from using features which could cause mis-compilation in environments like esbuild where each file is compiled independently without tracing type references across files. For example, it prevents you from re-exporting types from another module using export {T} from './types' (you need to use export type {T} from './types' instead).

@CHOYSEN
Copy link
Author

CHOYSEN commented Feb 21, 2021

Thanks, get it!

@CHOYSEN CHOYSEN closed this as completed Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants