Back to Type Challenges

README.Zh CN

questions/03312-easy-parameters/README.zh-CN.md

latest2.0 KB
Original Source
<!--info-header-start--><h1>Parameters </h1><blockquote><p>by midorizemi <a href="https://github.com/midorizemi" target="_blank">@midorizemi</a></p></blockquote><p><a href="https://tsch.js.org/3312/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-->

实现内置的 Parameters<T> 类型,而不是直接使用它,可参考TypeScript官方文档

例如:

ts
const foo = (arg1: string, arg2: number): void => {}

type FunctionParamsType = MyParameters<typeof foo> // [arg1: string, arg2: number]
<!--info-footer-start-->

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