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

Add types for Typescript #22

Closed
seisenreich opened this issue Dec 22, 2020 · 4 comments
Closed

Add types for Typescript #22

seisenreich opened this issue Dec 22, 2020 · 4 comments

Comments

@seisenreich
Copy link

seisenreich commented Dec 22, 2020

I tried to use this very promising looking spinner package in a typescript project.
And Typescript's linter told me that:

Could not find a declaration file for module 'react-spinners-css'. '/home/projec_path/node_modules/react-spinners-css/dist/index.js' implicitly has an 'any' type.
  Try `npm install @types/react-spinners-css` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-spinners-css';`ts(7016)

But there doesn't seem to be a @types/react-spinners-css package in the npm registry.
Will you add one, or can you tell me how I can make one by myself and publish it for others?
I never did that before, but I would tackle it after getting help about where to start :)

Kind regards

@JoshK2
Copy link
Owner

JoshK2 commented Dec 24, 2020

Hi, thanks for opening the issue and for using this package.
I'll soon update this library to be in TS and it will include types.

At the moment, you can create a d.ts file in your project to avoid ts warning:
react-spinners-css.d.ts
and inside:

declare module 'react-spinners-css';

@seisenreich
Copy link
Author

seisenreich commented Dec 24, 2020 via email

@JoshK2
Copy link
Owner

JoshK2 commented Apr 27, 2021

Hi, I published a new version with TypeScript support!!
https://www.npmjs.com/package/react-spinners-css

@JoshK2 JoshK2 closed this as completed Apr 28, 2021
@husleuujii
Copy link

hello , i am getting UnhandledPromiseRejectionWarning: Unhandled promise rejection on typescript

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

3 participants