News for hackers. Stuff that matters.
Re:Reason React 0.8 by shermanmccoy on Wednesday May 13, 2020 @08:27PM (#23173618)
For me a big strength is Reason's intolerance of null, this has eliminated a great number of bugs for me. Reason React ultimately forces you to think about every permutation of state your component might enter, and develop logic to handle that. JS/TS will never help you with that.
Re:Reason React 0.8 by s-km on Thursday May 14, 2020 @02:16AM (#23176015)
What do you mean? Typescript by default assumes non-null, and if you specify that something can be null it'll force you to check that it isn't before attempting to access it.
Re:Reason React 0.8 by shermanmccoy on Thursday May 14, 2020 @03:26AM (#23176490)
Sure. However the any type lets the nulls in. And the any type is very convenient, perhaps even necessary to use in some situations. So then you are back to plain old js check blocks and ternaries littered everywhere. If you miss one, well, I don't need to remind anyone of the ubiquitous js console error which every js developer has burned into the back of her/his brain.
Re:Reason React 0.8 by osdiab on Thursday May 14, 2020 @04:42AM (#23177031)
I use the no-explicit-any Typescript ESLint check and tsconfig no-implicit-any, never turn them off unless absolutely necessary, making this is a non-issue. Not that I’m not interested in Reason for other reasons though!
Re:Reason React 0.8 by shermanmccoy on Thursday May 14, 2020 @09:54AM (#23179504)
That's fine if you can control this configuration I suppose. But the escape hatch is there, so in my opinion TS doesn't go far enough.
Re:Reason React 0.8 by Vinnl on Thursday May 14, 2020 @03:25AM (#23176482)
Note that "by default" here means "when strict mode is on, which is explicitly turned on when you run tsc --init". If you don't specify a config value for strict mode, it will be off. (At least last time I checked.)