react-native-typewriter icon indicating copy to clipboard operation
react-native-typewriter copied to clipboard

Add type declarations for TypeScript users

Open roshnet opened this issue 4 years ago • 5 comments

Hi @TaylorBriggs,

I'm just came across this package. It looks good and worth trying out, but I cannot do that yet because of missing type declarations.

It would be great to have the corresponding @types declaration for this package, so that we can simply install types like so -

$ yarn add @types/react-native-typewriter

For now, I guess I will add custom declaration file or something to make it work :crossed_fingers:.
Thanks!

roshnet avatar Jan 06 '21 19:01 roshnet

I'll try to take a look when I can, but if you put the types together yourself there's nothing stopping you from publishing that; the beauty of open source. My experience with TypeScript is pretty limited, so do those types need to correspond to the props? Thanks for opening the issue, as I know TS is really popular these days.

TaylorBriggs avatar Jan 07 '21 16:01 TaylorBriggs

Indeed, I did that (had to add a definition file in node_modules/react-native-typewriter/). It works fine. Thing is, anyone installing (or updating) it has to add custom typings every time. I'll see if I can open a PR to get that fixed once I get some time.

PS: I'm now using this in the app I'm working on. Thanks again for writing the library!

roshnet avatar Jan 08 '21 09:01 roshnet

Quick solution found here: https://medium.com/@steveruiz/using-a-javascript-library-without-type-declarations-in-a-typescript-project-3643490015f3

I may add typing if I get the chance :)

JosephPBallantyne avatar Feb 21 '22 16:02 JosephPBallantyne

@TaylorBriggs @roshnet While it's better when it's embedded within the repository, I've made a PR for typing https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64283

if you need to add it directly on the repo, just tell me I'll explain you. (would be better)

ScreamZ avatar Feb 08 '23 21:02 ScreamZ