PokeAPI / pokeapi-js-wrapper

PokeAPI browser wrapper, fully async with built-in cache
Mozilla Public License 2.0
278 stars 44 forks source link

Add index.d.ts file #10

Closed rugglcon closed 5 years ago

rugglcon commented 5 years ago

Could a typings file be made for this project so it's easier used with TypeScript? I'd also be willing to work on this if everyone is too busy to do it.

Naramsim commented 5 years ago

Hi, I'm not familiar with Typescript. This project is full Javascript. I don't know if adding an index.d.ts would be beneficial and I don't even know what to put in it. Can you link me to some resources?

rugglcon commented 5 years ago

So after looking at the code, it would be relatively difficult. You’d have to do it manually, but here’s a link to the documentation on typings files. https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

Naramsim commented 5 years ago

Hi @rugglcon, I just read the initial part and they specifically require a medium level of Typescript knowledge to understand the parts later on. I don't have it.

I don't think it's really necessary to add this index.d.ts, but you can do it and then explain to me how can it be helpful.

Thanks!

rugglcon commented 5 years ago

Yeah sure, I can open up a PR with it explaining what it's use is but I can give a brief explanation now.

Essentially all it would do is give type validation for using this library with TypeScript. What I could also do is open a PR with DefinitelyTyped for this library so it could be installed with npm install --save-dev @types/pokeapi-js-wrapper and then it doesn't have to be merged into this repo.

Let me know what you would prefer, since this really would have no impact on the functionality of the project, just eases use with TypeScript. Thanks!

Naramsim commented 5 years ago

@rugglcon, feel free to help this project wherever you feel is better. I will definitely allow new contribution!