-
Notifications
You must be signed in to change notification settings - Fork 143
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
Typescript import-equals is transpiled incorrectly #748
Comments
Hi @janmeier , thanks for the report! Yes, this is in-scope for Sucrase to handle. I'll try coming up with a fix when I get a chance. I think it should be pretty easy, the code to the right of the |
I took a closer look and it's harder than I expected, but should still be doable. I made a related fix back in #441 , and it turns out that this If I just change import {Foo} from 'type-only-file-that-doesnt-exist-at-runtime';
import Bar = Foo;
const b: Bar = {}; The ideal fix is to just implement TypeScript's behavior, though there may be a simpler fix for just this reported case if I make |
Thanks, I appreciate you looking into this! Luckily this only occurs if you import a type in codegen and then rename the type. So in our case we can simply change how types are exported for gql codegen to work around the issue |
Nice to know |
Sample code:
tsc output playground
sucrase output (using
[email protected]
)Context
This is in ts code generated by graphql-codegen, so I cannot easily change it. I found a similar esbuild issue, evanw/esbuild#1283
I hope this is within the scope of sucrase 🤞
The text was updated successfully, but these errors were encountered: