Back to Type Challenges

README.Ja

questions/00189-easy-awaited/README.ja.md

latest2.1 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/ja" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

Promise ライクな型が内包する型をどのように取得すればよいでしょうか。

例えば:Promise<ExampleType>という型がある場合、どのようにして ExampleType を取得すればよいでしょうか。

ts
type ExampleType = Promise<string>

type Result = MyAwaited<ExampleType> // string

この問題の元記事は original article by @maciejsikora です。

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

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