Skip to content

Instantly share code, notes, and snippets.

@mayognaise
Created July 27, 2023 06:10
Show Gist options
  • Save mayognaise/8f4b6a4445cd657647e515ce49e8cd12 to your computer and use it in GitHub Desktop.
Save mayognaise/8f4b6a4445cd657647e515ce49e8cd12 to your computer and use it in GitHub Desktop.
Define a key as optional
// 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