Back to Type Challenges

README.Ja

questions/00057-hard-get-required/README.ja.md

latest1.9 KB
Original Source
<!--info-header-start--><h1>Get Required </h1><blockquote><p>by Zheeeng <a href="https://github.com/zheeeng" target="_blank">@zheeeng</a></p></blockquote><p><a href="https://tsch.js.org/57/play/ja" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> </p><!--info-header-end-->

必須なフィールドのみを残す高度なユーティリティ型 GetRequired<T> を実装してください。

例えば

ts
type I = GetRequired<{ foo: number, bar?: string }> // expected to be { foo: number }
<!--info-footer-start-->

<a href="../../README.ja.md" target="_blank"></a> <a href="https://tsch.js.org/57/answer/ja" target="_blank"></a> <a href="https://tsch.js.org/57/solutions" target="_blank"></a> <hr><h3>関連する課題</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00059-hard-get-optional/README.ja.md" target="_blank"></a> <!--info-footer-end-->