Please follow the template and fill the info. A PR will be auto-generated and always reflect on your changes.
Detailed solution/guide is not required, but please be sure the challenge is solvable.
Info
Basic info of your challenge questions,
difficulty: easy # medium / hard / extreme
title: Awaited
tags: promise # separate by comma
editor:
github: sinoon
name: sinoon
author:
github: maciejsikora
name: Maciej Sikora
Question
If we have a type which is wrapped type like Promise. How we can get a type which is inside the wrapped type? For example if we have Promise how to get ExampleType?
This is the template for challengers to start the coding. Basically, you just need to change the name of your generic/function and leave to implementation any.
type Awaited = any
Test Cases
Provide some test cases for your challenge, you can use some utils from @type-challenges/utils for asserting.
import { Equal, Expect } from '@type-challenges/utils'
type X = Promise<string>
type Y = Promise<{ field: number }>
type cases = [
Expect<Equal<Awaited<X>, string>>
Expect<Equal<Awaited<Y>, { field: number }>>
]
Info
Basic info of your challenge questions,
Question
If we have a type which is wrapped type like Promise. How we can get a type which is inside the wrapped type? For example if we have Promise how to get ExampleType?
Template
This is the template for challengers to start the coding. Basically, you just need to change the name of your generic/function and leave to implementation
any
.Test Cases
Provide some test cases for your challenge, you can use some utils from
@type-challenges/utils
for asserting.