piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 98 forks source link

Can this tool be used with a (non-TS) React app #217

Closed mrassili closed 4 years ago

mrassili commented 4 years ago

Hi,

Sorry for putting this here, I haven't found any active place to ask?

So we have a React application already written in JS (all .js files) so we wanted to use this library but I have no idea if we should re-write our app in TS or what?

Thanks

piotrwitek commented 4 years ago

Hey @mrassili Already answered on the gitter but I'll copy my answer here as well:

Yes, it will work perfectly in JS without TypeScript, but you'll miss a lot of benefits of the library. I would recommend using either vscode and enabling allowJs for type checking in JS to get some of the benefits, but to get all the benefits and catching all possible errors you'd have to at lease write all your redux code and action creators in TS following the react-redux guide and the rest of the application like UI components could be written in pure JS but I would recommend using a .tsx extension.