how to use generics with arrow functions code example
Example 1: generic arrow function typescript
const foo = <T extends unknown>(x: T) => x;
Example 2: why can't define generic function in tsx file
const f = <T1, _>(arg1: T1) => {
return { arg1 };
};
// or just adding a comma
const g = <T1,>(arg1: T1) => {
return { arg1 };
};