Type Challenges Judge

Flip

提出詳細

type Formattable = string | number | bigint | boolean | null | undefined type Flip<T> = { [K in keyof T as `${T[K] & Formattable}`]: K }
提出日時2023-09-18 02:11:11
問題Flip
ユーザーsankantsu
ステータスAccepted
テストケース
import type { Equal, Expect, NotEqual } from '@type-challenges/utils' type cases = [ Expect<Equal<{ a: 'pi' }, Flip<{ pi: 'a' }>>>, Expect<NotEqual<{ b: 'pi' }, Flip<{ pi: 'a' }>>>, Expect<Equal<{ 3.14: 'pi'; true: 'bool' }, Flip<{ pi: 3.14; bool: true }>>>, Expect<Equal<{ val2: 'prop2'; val: 'prop' }, Flip<{ prop: 'val'; prop2: 'val2' }>>>, ]