TSworkingts-evergreen
Generics, the basics
One function, every type.
Generics let a function, class, or type take a type as a parameter — so you write identity<T> once and it stays type-safe for strings, numbers, and your own interfaces alike.
identity<T>: the canonical generic
TSintro Press Run to execute
The values print as hello 42 true and their runtime tags as string number boolean — proof the single identity definition preserved each distinct type rather than collapsing them to any.