Reputation: 51
I need 'react-keydown' module in my project but i cant find typing's for it . How can I use this module in my typescript project?
Upvotes: 3
Views: 1389
Reputation: 118
Typescript need to recognize your JS library as a Typescript. To achieve this you need a ".d.ts" file (react-keydown.d.ts), It's a interface for the JS functions. There's a Github called DefinitelyTyped and they have React there. I don't know if you only want one function or if this can help but here's the link.
Upvotes: 1
Reputation: 8096
Joao mentioned DefinitelyTyped which is where you should start. If you can't find the library there you either need to create your own definition or declare the 3rd party library as any
. You won't get any typedefs of course but you will be able to compile and use the library.
declare var ThirdPartyLibrary;
ThirdPartyLibrary.doStuff();
Upvotes: 1