Closed
Description
Consider:
type Foo = {
key: 'foo'
bar: 'bar1'
}
type Bar = {
key: 'bar'
bar: 'bar2'
baz: any
}
/**
* @interface
*/
type DiscriminatedUnion = Foo | Bar;
This renders as:
{
key: 'foo' | 'bar'
bar: 'bar1 | 'bar2'
}
The type above is overly-broad with respect to the key
and bar
properties (their values are correlated), and omits the baz
property entirely.