Generics in Typescript

Gagandeep Singh
Tuples is a type that exists in Typescript which is similar to Array type but has fixed length and defined what kind of element (either same or different types) will be there at a certain position. // Array example const a: number[] = [1, 2, 3]; // Tuple example const t: [string, number, boolean] = ["2", 1, true]; Since Tuples are just arrays, so it will allow to push a new element only of type either string or number as defined in the tupleType below.