Is there a type-safe way of expressing this function? In this example, I'm adding numbers, but the question is about the general pattern.
type signature =
((a: number, b: number) => number) &
((a: bigint, b: bigint) => bigint);
// Operator '+' cannot be applied to types 'number | bigint' and 'number | bigint'.
const add : signature = (a, b) => a + b;
The two arguments can be two different types, but should never be both at the same time. Is there a way to write this function type so it works?