Giving following typescript code. how would you omit the email that is inside options and inside data?
interface SignUpObject {
email:string, // not this one
password: string,
options: {
emailRedirectTo: string,
captchaToken?: string,
data: {
preferedLanguage: number
name: string
email: string // but this one!
agreeTermsCheckbox: boolean
whatJobYouHave: number
birthday: string
techYearsOfExpierence: string
is_subscriber: boolean
is_admin: boolean
subscriber_expiration_timestamp: string | null
}
}
}
I already omit password:
interface UpdateUserData extends Omit<SignUpObject, 'password'> {
password?: string
}
I try search online, reading the docs, looking in forums and more
2
Answers
Overwrite
options.data
as you did forpassword
field:You could use a recursive generic type to filter a particular object path out:
Playground