TypeScript Coding Practice
Practice typing real code syntax, including brackets, punctuation, and indentation. Snippets are for typing practice only and are never executed.
Generic functions
Type the code exactly. Tab inserts four spaces. Code is not executed.
Progress: 0%
Current mismatches: 0
function identity<T>(value: T): T {
return value;
}
const label: string = identity<string>("typed safely");
console.log(label);
Type the code exactly, including spaces and indentation.