Sequence NODE_168
Easy

Write a Generic Identity Function

TypeScript
Technical Specification

Implement a generic identity function that returns whatever value it receives with the correct type.

Input/Output Samples
Input:identity<string>('hello')
Output:string
Input:identity<number>(123)
Output:number
Optimal Logic Path
function identity<T>(value: T): T {
  return value;
}
Architectural Deep-Dive
Generics let the function adapt to the caller-specified type while preserving type safety.