Skip to content

Instantly share code, notes, and snippets.

@realyze
Created September 19, 2018 01:34
Show Gist options
  • Save realyze/537342b47ec1da642748933302651caf to your computer and use it in GitHub Desktop.
Save realyze/537342b47ec1da642748933302651caf to your computer and use it in GitHub Desktop.
Make only some field optional
type MakeOptional<T, K extends keyof T> =
{[P in keyof Pick<T, K>]+?: T[P]} &
{[P in keyof Pick<T, Exclude<keyof T, K>>]: T[P]};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment