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

TypeScript error: Could not find a declaration file for module 'use-shopping-cart/utilities'. #324

Closed
ciruz opened this issue May 31, 2023 · 2 comments

Comments

@ciruz
Copy link
Contributor

ciruz commented May 31, 2023

When importing validateCartItems inside a TypeScript project, you will get an error.

Example code:

import { validateCartItems } from 'use-shopping-cart/utilities'
Type error: Could not find a declaration file for module 'use-shopping-cart/utilities'. 'D:/dev/node/next.js/examples/with-stripe-typescript/node_modules/use-shopping-cart/utilities/index.js' implicitly has an 'any' type.
  If the 'use-shopping-cart' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'use-shopping-cart/utilities';`

Related:
#231 (comment)
vercel/next.js#50541
vercel/next.js#50574

@dayhaysoos
Copy link
Owner

Thanks @ciruz, just letting you know I plan on taking a look tonight. Not sure why this is happening

ciruz added a commit to ciruz/use-shopping-cart that referenced this issue May 31, 2023
@ciruz
Copy link
Contributor Author

ciruz commented May 31, 2023

Hey @dayhaysoos I see index.js only exports the serverless.js, so TypeScripts expects a index.d.ts too, just pushed a simple fix.

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

2 participants