3 ms·
Not to nitpick too much, but wouldn't the function expecting an interface be a much better fit for a case like this?
by ajxs 7y ago
Not to nitpick too much, but wouldn't the function expecting an interface be a much better fit for a case like this?
- dtech 7y agoYou can name the things I left anonymous, wouldn't change the principles. The Typescript docs have more details and advantages for this specific scenario: https://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions https://www.typescriptlang.org/docs/handbook/advanced-types....