Created
August 9, 2022 23:57
-
-
Save tavareshenrique/65abbfdfb1155f98945e2e2c1dcf7a7b to your computer and use it in GitHub Desktop.
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
interface User { | |
email: string; | |
password: string; | |
avatar_url?: string; | |
} | |
// Partial<Type> | |
type PartialUser = Partial<User>; | |
/** | |
type PartialUser = { | |
email?: string | undefined; | |
password?: string | undefined; | |
avatar_url?: string | undefined; | |
} | |
*/ | |
// Required<Type> | |
type RequiredUser = Required<User>; | |
/** | |
type RequiredUser = { | |
email: string; | |
password: string; | |
avatar_url: string; | |
} | |
*/ | |
// Pick<Type, Keys> | |
type PickUser = Pick<User, "email" | "password">; | |
/** | |
* type PickUser = { | |
* email: string; | |
* password: string; | |
* } | |
* */ | |
// Omit<Type, Keys> | |
type OmitUser = Omit<User, "email" | "password">; | |
/** | |
* type OmitUser = { | |
* avatar_url: string; | |
* } | |
* */ | |
// Record | |
type LabelType = { | |
label: string; | |
color: string; | |
} | |
type UserRecord = Record<number, LabelType>; | |
/** | |
* type UserRecord = { | |
* 1: { | |
* label: string; | |
* color: string; | |
* } | |
* } | |
* */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment