Generics typescript

Estimated reading time: 1 minute

Generics

Generics use for reuseable / desired type .

function identity<T>(arg: T): T {
    return arg;
}
 identity:<string>("Mostafa Kamal");
 identity:<number>(21);
node.js, js, typescript, ts