4 ms·
> null/undefined is an inhabitant of every type in typescript, I would suggest purescript instead. If you want absolute certainty in your types with TS, you sh
by wwwigham 8y ago
> null/undefined is an inhabitant of every type in typescript, I would suggest purescript instead.
If you want absolute certainty in your types with TS, you should be using the `--strict` flag, which makes it so this is not the case.
- evmar 8y ago"absolute" is a bit of a funny qualifier to use here, given the many soundness holes in TS. For example (included with --strict): https://www.typescriptlang.org/play/#src=class%20Base%20%7B%0D%0A%20%20f(x%3A%20string%20%7C%20null)%20%7B%20%7D%0D%0A%7D%0D%0Aclass%20Derived%20extends%20Base%20%7B%0D%0A%20%20f(x%3A%20string)%20%7B%20x.charAt(3)%3B%20%7D%0D%0A%7D%0D%0Alet%20b%3A%20Base%20%3D%20new%20Derived()%3B%0D%0Ab.f(null)%3B https://www.typescriptlang.org/play/#src=class%20Base%20%7B%... (I like TS, I just don't think it fully solves this problem!)