Generics allows you to create a component that can work with a variety of types, not just a single one.

The code below is known as the "Hello World" of Generics.

function identity<Type>(arg: Type): Type {
  return arg
}

let myIdentity: <Type>(arg: Type) => Type = identity;

The identity function simply returns its argument, regardless of its type.

We can use an Interface to rewrote this variable type

interface GenericIdentityFn {  
	<Type>(arg: Type): Type;
}

function identity<Type>(arg: Type): Type {  
	return arg;
} 

let myIdentity: GenericIdentityFn = identity;