TypeScript Omitで特定のプロパティを削除した型をつくる
特定のプロパティを削除したい場合はOmitを使います。
type T1 = {
hoge: string
foo: number
bar: boolean
}
type T2 = Omit<T1, 'foo'>
type T3 = Omit<T1, 'foo' | 'bar'>
Webエンジニアの記録
特定のプロパティを削除したい場合はOmitを使います。
type T1 = {
hoge: string
foo: number
bar: boolean
}
type T2 = Omit<T1, 'foo'>
type T3 = Omit<T1, 'foo' | 'bar'>
最近のコメント