Hacker News new | ask | show | jobs
by acdibble 1188 days ago
This is possible with type predicates, example: https://www.typescriptlang.org/play?#code/C4TwDgpgBAYg9nKBeK...

docs: https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...