Generics & Enums
Type-independent reusable structures (generics <T>) and named constants (enums).
Simple enough for a 5-year-old to understand
Generic ( <T> )
T is a "type placeholder". The actual type is determined when calling the function — making it both safe and flexible.
function ilk<T>(arr: T[]): T { return arr[0];}console.log(ilk([10, 20, 30]));console.log(ilk(["a", "b"]));