Re:Why don't more languages offer flow typing?
by mhink on Monday April 04, 2022 @04:26PM
(#30911560)
Yeah, they're called "type predicates" (or "type guards"). So you can do something like
and Typescript is smart enough to let you use it in an if-branch
Typescript also has typechecker support for assertion functions. So like,
Which we can use like so:
[ Parent
| on HN ]
There are no comments on this comment yet.