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

Sucrase's typings for ESM are invalid #848

Open
CosmoMyzrailGorynych opened this issue Jan 7, 2025 · 0 comments
Open

Sucrase's typings for ESM are invalid #848

CosmoMyzrailGorynych opened this issue Jan 7, 2025 · 0 comments

Comments

@CosmoMyzrailGorynych
Copy link

CosmoMyzrailGorynych commented Jan 7, 2025

Using Sucrase is currently impossible without errors in a ESM project. It includes types only for CJS format that do not have the same export structure.

This imports a valid transform method in ESBuild but throws errors in TypeScript:
изображение

This doesn't throw TypeScript errors but both are undefined and thus unusable:
изображение

If I look into sucrase/dist/esm/index.js, I can see that the only three exported methods are transform, getFormattedTokens, and getVersion.
If I look into sucrase/types/index.d.ts, I see getVersion, sucrase instead of transform, getFormattedTokens, and some types.

I'm using the latest for today version 3.35.0, for the record.

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

1 participant