Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Identity function using Generics https://medium.com/p/177b4a654ef6
const identity = <T>(arg: T): T => arg;
identity<string>('someString'); //would return 'someString'
identity<number>(12); //would return 12
identity<boolean>(false); //would return false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.