Re:Is your programming language unreasonable? (2015)
by throw_m239339 on Saturday October 10, 2020 @01:55PM
(#24740628)
Well Typescript is really a static code analyser for Javascript and not a language, since it does nothing at runtime, and that's fine, its type system can catch a broad range of issues and improve code quality drastically. It's a huge godsend for big codebases. But afaik it doesn't guard against null by default.
A simpler example:
declare type Foo = {name:String};
declare function getFoo():Foo|null;
const f = getFoo();
if(f!==null) // mandatory or yields an error
console.log(f.name);
But afaik it doesn't guard against null by default.
A simpler example:
But afaik it doesn't guard against null by default.