Created
December 10, 2020 07:48
-
-
Save preetjdp/fa9111ed798f1becc0e90cfd98811548 to your computer and use it in GitHub Desktop.
Generic Optional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ref -> https://github.com/Microsoft/TypeScript/issues/25760#issuecomment-614417742 | |
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>; | |
interface User { | |
uuid: string | |
name: string | |
} | |
const createUser = (user: Optional<User, "uuid">): void => { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment