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

@giphy/js-components throws error for throttle-debounce #182

Open
MickL opened this issue Apr 14, 2021 · 9 comments
Open

@giphy/js-components throws error for throttle-debounce #182

MickL opened this issue Apr 14, 2021 · 9 comments

Comments

@MickL
Copy link

MickL commented Apr 14, 2021

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.

@giannif
Copy link
Collaborator

giannif commented Apr 14, 2021

@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

@MickL
Copy link
Author

MickL commented Apr 15, 2021

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.

@giannif
Copy link
Collaborator

giannif commented Apr 22, 2021

@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

@MickL
Copy link
Author

MickL commented Apr 22, 2021

I am just importing import { renderGif } from '@giphy/js-components'; and it throws this error.

@giannif
Copy link
Collaborator

giannif commented Apr 26, 2021

@MickL okay, I will move it to dependencies in the next release 👍

@pshoniuk
Copy link
Contributor

@MickL Are you still facing this problem? It seems that this issue is no longer relevant.

@q00u
Copy link

q00u commented Feb 7, 2022

This problem appears to still exist on your @giphy/js-components sandbox

@giannif
Copy link
Collaborator

giannif commented Feb 7, 2022

@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

@Amirbarzegari
Copy link

The error still exists. (Grid component works fine but in the grid.tsx Vs code was showing the error)

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

5 participants