TypeScript 再帰的にPartial型にする DeepPartial
code:deepPartial.ts
export type DeepPartial<T> =
DeepPartialとDeepAny
やりたいこと
code:User.ts
type User = {
id: number,
name: {
first: string,
last: string,
},
gender?: string,
hobby: string[]
}
↑の型を↓の型に変換したい
code:deepAnyUser.ts
type User = {
id?: number,
name: {
first?: string,
last?: string,
},
gender?: string,
hobby?: string[]
}