Skip to content

Instantly share code, notes, and snippets.

@frivolta frivolta/genericType.ts
Last active Jan 10, 2020

Embed
What would you like to do?
// Add a new generic type T
const filterArrayByValue = <T>(
items: T[],
propertyName: string,
valueToFilter: string
): T[] => {
return items.filter(item =>item[propertyName] === valueToFilter);
};
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.