Diff
提出詳細
type Diff<O, O1> = { [P in Exclude<(keyof O | keyof O1), (keyof O & keyof O1)>]: P extends keyof O ? O[P] : P extends keyof O1 ? O1[P] : never }
提出日時 | 2023-08-30 13:29:09 |
---|---|
問題 | Diff |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type Foo = { name: string age: string } type Bar = { name: string age: string gender: number } type Coo = { name: string gender: number } type cases = [ Expect<Equal<Diff<Foo, Bar>, { gender: number }>>, Expect<Equal<Diff<Bar, Foo>, { gender: number }>>, Expect<Equal<Diff<Foo, Coo>, { age: string; gender: number }>>, Expect<Equal<Diff<Coo, Foo>, { age: string; gender: number }>>, ]