Get Required
提出詳細
type GetRequired<T extends object> = { [P in keyof T as {} extends Pick<T, P> ? never:P]: T[P]; }
提出日時 | 2022-06-28 10:30:13 |
---|---|
問題 | Get Required |
ユーザー | waki285 |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<GetRequired<{ foo: number; bar?: string }>, { foo: number }>>, Expect<Equal<GetRequired<{ foo: undefined; bar?: undefined }>, { foo: undefined }>>, ]