Partially Optional
Make some keys on a type optional. Opposite of PartiallyRequired.
typescript
type PartiallyOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
Usage
typescript
type User = {
name: string
email: string
}
// Type where `email` is optional, but `name` is still required
type UserWithEmailOptional = PartiallyOptional<User, 'email'>