Hacker News new | ask | show | jobs
by tango12 3059 days ago
Prevent null bugs.

Typescript values can be null. A pure reason program will never have null bugs.

https://reasonml.github.io/docs/en/type.html

2 comments

In case anyone didn't know, since Typescript 2 there is a compiler option to enable strict null checking.

https://blog.mariusschulz.com/2016/09/27/typescript-2-0-non-...

Only since 2.7 (very recently) can you actually enforce initialization of class properties: https://www.typescriptlang.org/docs/handbook/release-notes/t...
I was just wondering about this today; thx for the link! Not sure how I missed it.
Unfortunately, libraries such as React have their own component lifecycle management, which doesn't play well with this (https://reactjs.org/blog/2015/12/18/react-components-element...).

This is also a bit of a pain point on Android with Java @NonNull annotations or when using Kotlin.

Yeah... It would honestly be cool to have a TypeScript native React(as crazy as that sounds). There are some really great projects out there killing it like Nest, MobX, TypeORM, etc.. The React typings have come a long way though.

I do quite a bit of TypeScript for the server though(less context switching and is mostly GoodEnoughâ„¢) so still handy.

Angular plays very well with typescript, because the entire framework is written in it, more than that, Angular Team is working with TypeScript Team to help make TS better, and vice-versa.
Not true, TS has strict null checking