josepot / rereducer

Create declarative redux reducers without boilerplate.
MIT License
13 stars 1 forks source link

Add typings for rereducer #3

Closed voliva closed 6 years ago

voliva commented 6 years ago

These are an initial version for typings in Typescript 2.9+.

For rereducer, the default export, we could cover the case so that if the flag strictFunctionTypes is on, a type guard can be applied on discriminated unions of actions (see test case rereducer.d.test.ts@82 https://github.com/josepot/rereducer/pull/3/files#diff-6fb0ade90b108f97744ee29562cdb18bR82)

Things to be addressed:

josepot commented 6 years ago

This is awesome! Thanks a lot @voliva !

Maybe add typings testing to CI?

Could you please do that before we merge it? It should be pretty straightforward. I think that adding a line with npm run test:types inside the scripts section of the .travis.yml file should do the trick.

Some functions have types such as any in them. See how can they be improved

:+1: One step at a time.

Improve TS autoinheritance, many of the basic methods need a explicit definition of the generics.

Yep, that's a bit annoying. I think that I have some ideas for that... But again: one step at a time.

josepot commented 6 years ago

Merged! Thanks a lot!

Please, do not remove this branch yet.