Diff
提出詳細
type Diff<T,U> = { [K in Exclude<keyof T,keyof U> | Exclude <keyof U,keyof T>]: K extends keyof T ? T[K] : K extends keyof U ? U[K] : never }
提出日時 | 2023-09-14 12:08:58 |
---|---|
問題 | Diff |
ユーザー | sankantsu |
ステータス | 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 }>>, ]