Is there ArgumentsType like ReturnType in Typescript?

前端 未结 6 697
一个人的身影
一个人的身影 2020-11-30 12:34

ReturnType extracts return type of a function.

Is there a way to define ArgumentsType that extracts parameter types of a

6条回答
  •  眼角桃花
    2020-11-30 12:58

    As of TypeScript 3.1, Parameters type is now a part of the standard library.

    type Result = Parameters<(a: number, b: string) => boolean>; // [number, string]
    

提交回复
热议问题