JamesBrill / react-speech-recognition

💬Speech recognition for your React app
https://webspeechrecognition.com/
MIT License
657 stars 119 forks source link

Feature/typescript support #52

Closed vahdet closed 4 years ago

vahdet commented 4 years ago

This PR introduces Typescript to the content of src directory in such ways:

JamesBrill commented 4 years ago

Many thanks for making these changes, @vahdet - I certainly learned something from reading them.

I must admit I wasn't expecting the library itself to be rewritten in TypeScript, just the addition of a declaration file. Is there any advantage to consumers of this library for it to be written in TypeScript? Or is a declaration file sufficient? We now have types defined under @types here.

I do not wish to undermine your efforts here, but if the declaration files in DefinitelyTyped are sufficient to enable simple integration of this library into TypeScript projects, then I would prefer it to remain vanilla JavaScript, mainly because I prefer to keep the build simple for development and the language one that I'm familiar with. That's not to say I don't see the benefits of TypeScript - I may choose to adopt it in future, in which case your PR here will serve as a fantastic starting point for making that migration.

vahdet commented 4 years ago

@JamesBrill You are right, this PR goes well beyond the adding TypeScript support as the types are added to the DefinitelyTyped by @OleksandrYehorov as stated here. All in all, this lib can now be used by TypeScript projects -which was the main motive.

And, yes, it can be a reference once you consider rather a TypeScript re-write. Thus, I do not think postponing/closing this PR is a loss of effort or such (I had already did the changes on my fork before deciding to send as a PR). So, feel free :)

JamesBrill commented 4 years ago

I'll close this PR and the issue as TypeScript consumers seem to be unblocked for now. Thanks for raising the issue and providing these changes for reference.