I'm trying to make a typescript function that takes an argument that matches one of two conditions:
type A = {
x: string
}
type B = {
y: string
}
function testFunc(param: A | B) {
...
}
however typescript lets me call the function with both keys:
testFunc({x: "x", y: "y"})
Shouldn't the union type make it so that this function requires A or B?
Playground demonstrating the issue here