I have a function like this:
interface Interface1 {
one: string
}
interface Interface2 {
two: string
}
interface Interface3 {
three: string
}
type ManyInterfacesInOneType = Interface1 | Interface2 | Interface3;
function bla(param1: ManyInterfacesInOneType) {
}
When I try to use the function like this and I call the function like bla({...}), it lets me put variables from all the interfaces, but I want the function to be limited to one out of many. So I don't want this to happen:
bla({one: '', two: '', three: ''});
I also tried doing:
function bla<T extends object>(param1: T) {
}
But this doesn't make the generic type required, so it doesn't even really help.
Any ideas how I can make this work?