Skip to content

Instantly share code, notes, and snippets.

@VitorLuizC
Last active June 13, 2018 18:16
Show Gist options
  • Save VitorLuizC/4b69c961c66841883c41f3a161a6fc42 to your computer and use it in GitHub Desktop.
Save VitorLuizC/4b69c961c66841883c41f3a161a6fc42 to your computer and use it in GitHub Desktop.
declare type NonNullablePropertyNames <T extends Object> =
{ [K in keyof T]: T[K] extends null | undefined ? never : K }[keyof T];
declare type Merge <T extends Object, U extends Object> =
Pick<T, Exclude<keyof T, keyof U>> & Pick<U, NonNullablePropertyNames<U>>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment