I'd like to create an interface for a function using generics, such that the function takes in two arguments, and returns either the type of the first argument, or a union of the two. I had thought it was possible to do something like this:
declare interface CustomMerge {
(x: Partial<T1>, y: Partial<T1 | T2>): T1 | T1 & T2;
}
But I get all sorts of errors about unexpected symbols here, so I suspect I'm quite a way off the mark with what I've done so far. Is this possible with typescript?