function identity<T>(value: T): T { return value; } // Using the generic function let result = identity<number>(5); // here, T is replaced with number console.log(result); // Output: 5 let value = identity<string>("Hello"); // here, T is replaced with string console.log(value.toUpperCase());