scrollyfills
scrollyfills copied to clipboard
Typescript import issue: no declaration file for module
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.
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.