stripe-js: [BUG]: Types are very incorrect in the package now in 3.x
What happened?
Attempting to install the package in a remix app. Types are fully broken for this package. You can see the incorrect fields in https://publint.dev.
app/routes/settings.pay.$plan.tsx:4:28 - error TS7016: Could not find a declaration file for module '@stripe/stripe-js'. '/Users/mikecousins/dev/foos/node_modules/.pnpm/@stripe+stripe-js@3.0.0/node_modules/@stripe/stripe-js/dist/stripe.mjs' implicitly has an 'any' type.
There are types at '/Users/mikecousins/dev/foos/node_modules/@stripe/stripe-js/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@stripe/stripe-js' library may need to update its package.json or typings.
4 import { loadStripe } from '@stripe/stripe-js';
Environment
- Typescript
- Remix
Reproduction
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 20 (9 by maintainers)
Commits related to this issue
- Fix types for exports (#542, #543, #545) See: https://github.com/microsoft/TypeScript/issues/52363#issuecomment-1659179354 — committed to stripe/stripe-js by fruchtose-stripe 5 months ago
- Fix types for exports (#542, #543, #545) (#549) ### Summary & motivation Two fixes here: 1. Types for ES modules need to be specified on a per-module basis, as suggested in https://github.com/mic... — committed to stripe/stripe-js by fruchtose-stripe 5 months ago
looks great, thanks @fruchtose-stripe
Please download version v3.0.5 for corrected type declarations. Additionally, this issue has been remediated fully by release v3.0.4, so I’m going to close this issue. Thank you all for your patience up to this point. Please open a new issue if you continue to see related issues.