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 import issue: no declaration file for module #12

Open
djwashburn opened this issue Mar 7, 2024 · 1 comment
Open

Typescript import issue: no declaration file for module #12

djwashburn opened this issue Mar 7, 2024 · 1 comment

Comments

@djwashburn
Copy link

I'm trying to use the scrollend polyfill from TypeScript, and encountering this issue:

Could not find a declaration file for module 'scrollyfills'. '/path/to/module-name.js' implicitly has an 'any' type

For now, I am solving the issue by creating my own empty scrollyfills.d.ts in my project, which just types everything as 'any' by default and gets the TypeScript compiler to stop complaining. Ideally, we could create a proper type declaration file, but even just adding an empty one to the repo would avoid this error when trying to use the module from TypeScript code.

@gustaveWPM
Copy link

Why not just this?

// eslint-disable-next-line import/no-extraneous-dependencies
require('scrollyfills').scrollend;

As it is a polyfill, it doesn't upset me.

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