babel-plugin-tcomb
babel-plugin-tcomb copied to clipboard
Add support for Variable declarations (let)
Example
let bar: bool = foo;
bar = true;
compiles to
let bar = _assert(foo, _t.Boolean, "bar");
bar = _assert(true, _t.Boolean, "bar");
@christophehurpeau let me know if you want to work on this. From my part I'd love to help you out writing a test suite which I'll post later here or in a apposite branch
bar = true; should not compile to bar = _assert(true, _t.Boolean, "bar"); because we know that true is a boolean, in my opinion.
Yeah, but seems just an optimization which btw implies a bit of (albeit basic) static analysis, I think it doesn't worth it to complicate the plugin code for this. In the end of the day asserts will be discarded in production builds
see #111
Hi!
It's slightly unclear — plugin still does not support lets?