babel-plugin-tcomb icon indicating copy to clipboard operation
babel-plugin-tcomb copied to clipboard

The $Call-way

Open ArmorDarks opened this issue 7 years ago • 0 comments

First of all, thanks for tcomb. Love it!

Now, we started to use Flow in our project and, it became obvious that dynamic and static type checking doesn't live hand to hand out of the box, and we are forced to duplicate tcomb types with Flow types, and vice versa.

babel-plugin-tcomb seems to be an interesting solution, but it has it owns issues too. But what troubles me the most — it isn't an obvious solution. When you open a new project, it takes time to realize where some tcomb typing coming from, as they aren't available until Babel does its magic.

Recently I've stumbled on @xanf gist which cleverly uses $Call on pair with typed-contracts to extract types from the typing function.

I've definitely loved how obvious solution is for the end consumer. It is clearly seen that ExtractType does some magic. And it does not require any additional Bable transpilation on top.

I wonder, if tcomb would be provided with Flow typings, will it be possible to make the same thing with tcomb?

ArmorDarks avatar Oct 12 '18 13:10 ArmorDarks