Is it possible to create a union type from siblings of the same interface?
For example:
interface Foo {
values: string[];
defaultValue: string;
}
function fooo({values, defaultValue}: Foo) {}
fooo({values: ['a', 'b'], defaultValue: 'a'}); // This is a correct example
fooo({values: ['a', 'b'], defaultValue: 'c'}); // I want to avoid this case!
// Default value must be either 'a' or 'b'
// Similar to tuple type 'a' | 'b'
Can this be achieved?