OmitByType
提出詳細
type OmitByType<T, U> = { [P in keyof T as T[P] extends U ? never : P]: T[P] }
提出日時 | 2024-09-11 11:05:02 |
---|---|
問題 | OmitByType |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' interface Model { name: string count: number isReadonly: boolean isEnable: boolean } type cases = [ Expect<Equal<OmitByType<Model, boolean>, { name: string; count: number }>>, Expect<Equal<OmitByType<Model, string>, { count: number; isReadonly: boolean; isEnable: boolean }>>, Expect<Equal<OmitByType<Model, number>, { name: string; isReadonly: boolean; isEnable: boolean }>>, ]