Type Challenges Judge

Awaited

提出詳細

type A<T> = T extends Promise<infer U> ? A<U> : T; type B<T extends Promise<any>> = T extends Promise<infer U> ? A<T> : never
提出日時2024-10-28 06:50:34
問題Awaited
ユーザーbalckowl
ステータスWrong Answer
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type X = Promise<string> type Y = Promise<{ field: number }> type Z = Promise<Promise<string | number>> type cases = [ Expect<Equal<MyAwaited<X>, string>>, Expect<Equal<MyAwaited<Y>, { field: number }>>, Expect<Equal<MyAwaited<Z>, string | number>>, ] // @ts-expect-error type error = MyAwaited<number>