Skip to content

Instantly share code, notes, and snippets.

@dacioromero
Created September 13, 2019 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacioromero/727d321949faf313e0108c736cc4e52d to your computer and use it in GitHub Desktop.
Save dacioromero/727d321949faf313e0108c736cc4e52d to your computer and use it in GitHub Desktop.
type KeysMatchingValue<T, V> = { [P in keyof T]: T[P] extends V ? P : never }[keyof T]
type PickByValue<T, V> = Pick<T, KeysMatchingValue<T, V>>
type OmitByValue<T, V> = Omit<T, KeysMatchingValue<T, V>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment