Y
Hacker News
new
|
ask
|
show
|
jobs
by
fwouts
1418 days ago
Yes! They're called discriminated unions:
https://www.typescriptlang.org/docs/handbook/typescript-in-5...
Here's an example:
https://tseditor.fwouts.com/?t=ZXhwb3J0IHR5cGUgVmFsdWUgPSBVc...