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

Switch to TypeScript #99

Open
ilyasakin opened this issue Sep 25, 2020 · 5 comments
Open

Switch to TypeScript #99

ilyasakin opened this issue Sep 25, 2020 · 5 comments

Comments

@ilyasakin
Copy link
Contributor

So, it is no secret that this package lacks TypeScript support. Yeah @types/react-howler exists but most of the time it's out of sync.

Also with this switch we can directly cast react-howler's props to howler and use the types from @types/howler for props (also proper auto-complete support is huge bonus). So every time howler gets updated all we need to do is update howler and @types/howler.

@Stenerson
Copy link
Collaborator

I'm not opposed to adding TypeScript support, I've just never used it and – nothing against TypeScript – but I don't have the time or desire to learn it right now.

What's involved in adding support? I'm mostly just not sure how I can support it without understanding it. 🤷‍♂️ Ideas very much welcome.

@ilyasakin
Copy link
Contributor Author

ilyasakin commented Sep 26, 2020

Adding support involves creating d.ts files that have same names with js files and declare the types in them.

For instance, you need to create app.d.ts for app.js in same directory (you can place them in separate folder though).
Then all you need to do is declare types for functions, classes with declare keyword.

These links should give you brief information about d.ts:

Also you can take a look at @types/react-howler/index.d.ts

@Stenerson
Copy link
Collaborator

Thanks for the resources @iakindev. Unfortunately this just isn't something I'm going to be able to help much with... I'd happily accept a PR (especially if the TS definitions can be kept apart from the actual source to avoid source churn) but I would need community help with validation of the PR because like I said, I don't have the time or interest to learn this to a level where I'd be comfortable giving it the :shipit: myself.

If a PR were submitted and was given the stamp of approval by members of the community, I think it'd be easy enough to keep it up to date in the future. As has been discussed before and most already know, this package is pretty "feature mature" in the sense that it's just a convenient React wrapper around Howler. I don't see major things changing so I'd hope that TS support would be easy enough to maintain for future changes.

@slightlybelowzen
Copy link

hey, so I'm using typescript and I've used react howler before so if you're still looking for a PR I'd be happy to start working on one!

@Stenerson
Copy link
Collaborator

Hey @pn320, thanks for the comment. My views are pretty much the same as they were in my last comment. I'm using this package in production in a web app that has quite a bit of use and I'm personally not looking to add new features or create more maintenance to this package.

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