josepot / rereducer

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

test:types not working #8

Closed josepot closed 6 years ago

josepot commented 6 years ago

Hi @voliva ,

I just rebased my v3 branch from master and for my surprise the tests the types are passing, which is insane because the API has suffered some drastic changes and I have not touched your original typings (or its tests).

I'm not sure what's happening, but yarn test:types doesn't seem to do anything at all... I tried to checkout your latest commit (git checkout 7153ce8). I just wanted to make sure that I didn't break anything afterwords, because I have upgraded the libraries and the configuration. But, when I am in that commit if I make breaking changes to the API (like rename the exports of the library), the yarn test:types command still doesn't seem to do anything.

Could you please look into this?

Thanks a tone!

voliva commented 6 years ago

Hey @josepot

Those tests are completely independent from the implementation of rereducer - You don't even need it. The tool that runs them, dtslint, is based on tslint, which basically analyzes the declaration file .d.ts and for each test file in the types folder it looks if all types are the expected ones (so it covers inference and expected errors)

It doesn't have as much value as unit test do, because they are really close to the API contract, but I can still see some usefulness: For type documentation (as in what types of parameters does it expect), and maintance of the definitions file, as when changing them (say to improve autoinference) it will remind the specific use cases regarding types.

josepot commented 6 years ago

Ohhhh I get it! Those tests only test the types/index.d.ts definitions, whether those definitions have anything to do with the current API or not is a completely different story... Dah! Yep, I guess that makes sense. Thanks!