Back to Type Challenges

README.Zh CN

questions/00189-easy-awaited/README.zh-CN.md

latest2.2 KB
Original Source
<!--info-header-start--><h1>Awaited </h1><blockquote><p>by Maciej Sikora <a href="https://github.com/maciejsikora" target="_blank">@maciejsikora</a></p></blockquote><p><a href="https://tsch.js.org/189/play/zh-CN" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

假如我们有一个 Promise 对象,这个 Promise 对象会返回一个类型。在 TS 中,我们用 Promise<T> 中的 T 来描述这个 Promise 返回的类型。请你实现一个类型,可以获取这个类型。

例如:Promise<ExampleType>,请你返回 ExampleType 类型。

ts
type ExampleType = Promise<string>

type Result = MyAwaited<ExampleType> // string

这个挑战来自于 @maciejsikora 的文章:original article

<!--info-footer-start-->

<a href="../../README.zh-CN.md" target="_blank"></a> <a href="https://tsch.js.org/189/answer/zh-CN" target="_blank"></a> <a href="https://tsch.js.org/189/solutions" target="_blank"></a> <!--info-footer-end-->