Skip to content

Instantly share code, notes, and snippets.

@haldarmahesh
Created May 3, 2020 15:12
Show Gist options
  • Save haldarmahesh/11c4b3ac41cf3601c9afd9e502594918 to your computer and use it in GitHub Desktop.
Save haldarmahesh/11c4b3ac41cf3601c9afd9e502594918 to your computer and use it in GitHub Desktop.
export interface Person {
name: String;
}
export const convertToValueArray = <T>(value: T): Array<T> => {
return [value];
};
const person: Person = {
name: "Mahesh"
};
const firstPerson = convertToValueArray(person)[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment