Generics typescript
Estimated reading time: 1 minuteGenerics
Generics use for reuseable / desired type
.
function identity<T>(arg: T): T {
return arg;
}
identity:<string>("Mostafa Kamal");
identity:<number>(21);
Generics use for reuseable / desired type
.
function identity<T>(arg: T): T {
return arg;
}
identity:<string>("Mostafa Kamal");
identity:<number>(21);