chintan9 / plyr-react

A simple, accessible and customisable react media player for Video, Audio, YouTube and Vimeo
https://github.com/chintan9/plyr-react
MIT License
479 stars 53 forks source link

Typescript support #201

Closed lvndry closed 4 years ago

lvndry commented 4 years ago

Is there any plan to have support for Typescript?

chintan9 commented 4 years ago

It should work for typescript. If it is not then you can share with me.

madwyn commented 4 years ago

Thanks for your work.

When using plyr-react with Ionic and TypeScript, it won't import and gives the following error:

TS7016: Could not find a declaration file for module 'plyr-react'. '/Users/xxx/projects/myApp/node_modules/plyr-react/dist/index.js' implicitly has an 'any' type.   Try `npm install @types/plyr-react` if it exists or add a new declaration (.d.ts) file containing `declare module 'plyr-react';`

I'm not a TypeScript expert, but it seems there are many ways to resolve this: https://blog.atomist.com/declaration-file-fix/

chintan9 commented 4 years ago

Use this way https://stackoverflow.com/questions/55795060/how-to-import-js-in-ts-with-noimplicityany-and-without-allowjs

madwyn commented 4 years ago

Thanks for the prompt feedback.

I know there are workarounds, but I'm wondering if this can be implemented in the library itself?

chintan9 commented 4 years ago

@lvndry use to v3 now https://www.npmjs.com/package/plyr-react

chintan9 commented 4 years ago

@all-contributors please add @lvndry for Bug reports

allcontributors[bot] commented 4 years ago

@chintan9

I've put up a pull request to add @lvndry! :tada: