2 ms·
TypeScript has type guards, which covers #1. Also has custom type guards, which lets you write your own checks that constrain union types. TypeScript also has
by spion 11y ago
TypeScript has type guards, which covers #1. Also has custom type guards, which lets you write your own checks that constrain union types.
TypeScript also has a language services server which runs as a daemon, lets you submit incremental edits to it and supports services such as autocomplete, rename refactoring and pretty much anything you see in visual studio or visual studio code.
But yes, the type system has a couple of unfortunate flaws that are relics from its beginnings (cant express non-nullable types).