TS2558
Expected 2 type arguments, but got 1.
Broken Code ❌
function combine<X, Y>(a: X, b: Y): (X | Y)[] {
return [a, b];
}
combine<number>(1, '2');Fixed Code ✔️
The combine function defines 2 type variables (X & Y), so you have to pass it 2 type arguments:
function combine<X, Y>(a: X, b: Y): (X | Y)[] {
return [a, b];
}
combine<number, string>(1, '2');