Hacker News new | ask | show | jobs
by bazza451 2842 days ago
Real big fan of TS, like anything though you just have to be disciplined when using it. Type absolutely everything and set the transpiler to the most aggressive checks possible... If you’re being lazy and putting : any everywhere and then complaining about how good it is...you’re doing it wrong

In our project I’ve found we make a lot less mistakes than with pure JS and there’s a lot less pointless type check unit tests due to the guarantee’s it gives us. io-ts (https://github.com/gcanti/io-ts) around rest endpoints checking json input as well has been a godsend.

2 comments

I always use it with

> "compilerOptions": { "strict": true }

But given the huge number of other options I worry that like GCC's '-Wall', that doesn't actually give you the strongest possible type checking. Anyone know about that? My aim with Typescript is to turn JS into OCaml.

You might like https://bucklescript.github.io/ Facebook use it in Messenger.
> My aim with Typescript is to turn JS into OCaml

If that's the goal, why not use the real thing http://ocsigen.org/js_of_ocaml/ ?

So... ReasonML?
I share your view! Unfortunately, getting devs to write proper unit tests is – for whatever reason – difficult.

Types just smuggle themselves in with the rest of the program (granted they only cover a subset of the bugs tests do).