Two interfaces, AllTypes
type:
interface A {
// ...
}
interface B {
// ...
}
type AllTypes = A | B;
How can I utilize generics to ensure that a function's argument is an object with either interface A
or B
?
// pseudocode
function test<T oneof AllTypes>(argument: T): void {
// ...
}