|
|
|
|
|
by wwwigham
1917 days ago
|
|
Funny that the author mentions TypeScript, then complains that maintaining a system like this that "doesn't exist elsewhere" would be hard. TypeScript, in fact, does an analysis almost exactly like what is described in the article. Possibly even more expansive, since it also allows for user-defined assertions and guards, in addition to simple syntactic narrowing. |
|
This is a false-positive:
https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABMO...
> since it also allows for user-defined assertions and guards
Psalm allows user-defined type guards:
https://psalm.dev/docs/annotating_code/adding_assertions/