stripe-node
stripe-node copied to clipboard
NPM module alias doesn't allow for module type resolution.
Describe the bug
If we use an alias for stripe via npm:
npm i stripe-18@npm:[email protected]
We are unable to resolve the index.d.ts as a module, although its present within our node modules folder.
To Reproduce
- run
npm i stripe-18@npm:[email protected] - Within a .ts file that has access to the node_modules resources:
import Stripe from 'stripe-18';
This will result in the error: File '.../node_modules/stripe-18/types/index.d.ts' is not a module.
Expected behavior
We would expect that the module would be able to be resolved via the alias.
Code snippets
npm i stripe-18@npm:[email protected]
import Stripe from 'stripe-18'
OS
macOS
Node version
Node v18.16.1
Library version
stripe-node v18.0.0
API version
2025-03-31.basil
Additional context
No response
Is this a regression from v17 or is this a feature that's never worked?
I think it never worked. Stripe is declaring the module as declare module 'stripe', so if you install as an alias, the directory name will not match the module name and this will fail
This is on our radar to fix. Unfortunately, it's behind a lot of refactoring work, so we can't commit to a timeline when it'll be fixed.