1Generic functions
2
3// Something like the following works fine:
4function foo<T>(x: T): T { return x; }
5
6
7// However using an arrow generic function will not:
8const foo = <T>(x: T) => x; // ERROR : unclosed `T` tag
9
10
11// Workaround: Use extends on the generic parameter
12// to hint the compiler that it's a generic, e.g.:
13const foo = <T extends unknown>(x: T) => x;
1Typically a generic funtion is an instance of a class that inherit boht from function and standard objects .Thus generic functions are both fucntions and ordinary objects