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

[BUG]: type regression with moduleResolution: bundler #542

Closed
KirillTregubov opened this issue Feb 12, 2024 · 3 comments
Closed

[BUG]: type regression with moduleResolution: bundler #542

KirillTregubov opened this issue Feb 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@KirillTregubov
Copy link

What happened?

I am using "moduleResolution": "bundler" in my tsconfig compilerOptions in a typescript nextjs app and the latest version of this library has broken the types. Downgrading to 2.4.0 fixes the issue.

I looked at the changes from 2.4.0 to 3.0.0, but unfortunately cannot seem to find what exactly causes the issue. Changing moduleResolution to node fixes the issue, but the problem is that new apps created with create-next-app using typescript set the moduleResolution to bundler by default (I just verified this).

The linked reproduction has an open terminal that shows no type issues on 2.4.0, and the current type issue on the latest version.

Environment

Node v20.10.0 on Windows 11

Reproduction

https://codesandbox.io/p/devbox/stripe-reproduction-5gfdtn?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clsjfti1o0007356hi2sliwvz%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clsjfti1o0002356hwi8pclqk%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clsjfti1o0004356hti4luwwd%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clsjfti1o0006356h254tka7x%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clsjfti1o0002356hwi8pclqk%2522%253A%257B%2522id%2522%253A%2522clsjfti1o0002356hwi8pclqk%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clsjfti1o0006356h254tka7x%2522%253A%257B%2522id%2522%253A%2522clsjfti1o0006356h254tka7x%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsjfti1o0005356hnidihqet%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3000%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clsjfti1o0005356hnidihqet%2522%257D%252C%2522clsjfti1o0004356hti4luwwd%2522%253A%257B%2522id%2522%253A%2522clsjfti1o0004356hti4luwwd%2522%252C%2522activeTabId%2522%253A%2522clsjftl0s004d356h2w7jhsao%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clsjfti1o0003356hznjg67z5%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522clsjftl0s004d356h2w7jhsao%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522clsjg1pj2000edkhe6knabmlp%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

@KirillTregubov KirillTregubov added the bug Something isn't working label Feb 12, 2024
@cbala-stripe
Copy link
Contributor

We are actively investigating the best path forward for fixing this issue. In the meantime, we recommend usage of version 2.4.0, which is our last stable release. Thank you for your patience with this issue.

fruchtose-stripe added a commit that referenced this issue Feb 13, 2024
### Summary & motivation

Two fixes here:
1. Types for ES modules need to be specified on a per-module basis, as suggested in microsoft/TypeScript#52363 (comment)
1. A separate path reference fix for the `pure` module

### Testing & documentation

I tested this against packages which were compiled in webpack/vite with `"moduleResolution": "node16"` and `"moduleResolution": "bundler"` in `tsconfig.json`. I confirmed this fix works fore TypeScript 4+.
@maxwelly-stripe
Copy link
Contributor

Thank you for bringing up this issue with our team. We have published a new release which should resolve the issues you were having. Please upgrade to v3.0.1 instead of v3.0.0. Let us know if you continue to encounter any issues!

@KirillTregubov
Copy link
Author

v3.0.1 fixes my issue. Thank you so much @maxwelly-stripe !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants