When I remove
<IFirst extends {}, ISecond extends {}>
from the declaration of this function, the compiler generates an error. Isn't the return value supposed to be the type after the double dot? What does <IFirst extends {}, ISecond extends {}>
mean after the function name? Why do I need to include both <IFirst extends {}, ISecond extends {}>
and : IFirst & ISecond
in the declaration? I've searched through the documentation and online resources, but I haven't been able to find a satisfactory answer.
function extend<IFirst extends {}, ISecond extends {}>(
IFirst: IFirst,
ISecond: ISecond
): IFirst & ISecond {}