Created
July 27, 2023 06:10
-
-
Save mayognaise/8f4b6a4445cd657647e515ce49e8cd12 to your computer and use it in GitHub Desktop.
Define a key as optional
This file contains 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
// When one key is optional | |
type User = { | |
name: string | |
email: string | |
phone?: string | |
} | |
/** | |
type User = { | |
name: string; | |
email: string; | |
phone?: string | undefined; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment