giphy-js
giphy-js copied to clipboard
@giphy/js-components throws error for throttle-debounce
I followed the sdk and sandbox to simply render a single gif: https://codesandbox.io/s/1wq52x1w44?fontsize=14&file=/src/gif.ts
But when I import renderGif:
import { renderGif } from '@giphy/js-components';
It throws an error:
ERROR in /my-project-dir/node_modules/@giphy/js-components/dist/components/carousel.d.ts
ERROR in /my-project-dir/node_modules/@giphy/js-components/dist/components/carousel.d.ts(42,21):
TS7016: Could not find a declaration file for module 'throttle-debounce'. '/my-project-dir/node_modules/throttle-debounce/index.cjs.js' implicitly has an 'any' type.
Try `npm install @types/throttle-debounce` if it exists or add a new declaration (.d.ts) file containing `declare module 'throttle-debounce';`
ERROR in /my-project-dir/node_modules/@giphy/js-components/dist/components/grid.d.ts
ERROR in /my-project-dir/node_modules/@giphy/js-components/dist/components/grid.d.ts(58,21):
TS7016: Could not find a declaration file for module 'throttle-debounce'. '/my-project-dir/node_modules/throttle-debounce/index.cjs.js' implicitly has an 'any' type.
Try `npm install @types/throttle-debounce` if it exists or add a new declaration (.d.ts) file containing `declare module 'throttle-debounce';`
The docs do not state any dependency to throttle-debounce
. If there are no dependencies but the types are needed in order @giphy/js-components
to work, then they should be included in the package.json of @giphy/js-components
imo.
@MickL can you remove your node_modules dir and reinstall? This dependency is declared in our package.json, so not sure why the type declaration wouldn't be found
I tried but it is not working without installing @types/throttle-debounce
.
I see it is declared in you devDependencies but it seems like it is needed as a dependency instead.
@MickL if you're using it in your code, you'll need to add @types/throttle-debounce
to your package json. It is a dev dependency for our library, I'm pretty sure, since it's not part of an exported type.
I found this on stackoverflow and I don't think throttle debounce meets the below criteria of using it as a dependency.
import {SomeType} from 'some-module';
export default class APackageClass {
constructor(private config: SomeType) {}
}
I might be wrong though, if it is exported somehow then yeah I'll move it. I'm using the SDK in two other giphy projects and neither one have to import themselves
I am just importing import { renderGif } from '@giphy/js-components';
and it throws this error.
@MickL okay, I will move it to dependencies in the next release 👍
@MickL Are you still facing this problem? It seems that this issue is no longer relevant.
This problem appears to still exist on your @giphy/js-components sandbox
@q00u can you be more specific? I don't see any import errors here: https://codesandbox.io/s/1wq52x1w44?fontsize=14&file=/src/gif.ts
Also the sandbox needs to be updated, if you're seeing the error could you try updating @giphy/js-components
to the latest which is 5.2.0
? I don't see the error, so I can't test if the update fixes it
The error still exists. (Grid component works fine but in the grid.tsx Vs code was showing the error)