Diff
提出詳細
type Diff<O, O1> = { [ K in keyof O | keyof O1 as K extends keyof O & keyof O1 ? never : K ]: K extends keyof O ? O[K] : K extends keyof O1 ? O1[K] : never }
提出日時 | 2023-09-11 07:27:34 |
---|---|
問題 | Diff |
ユーザー | snaka |
ステータス | 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 }>>, ]