【发布时间】:2021-01-30 11:43:43
【问题描述】:
Function 和 (...args: any[]) => any 有什么区别?
有趣的是,我刚刚注意到Function 不能分配给(...args: any[]) => any,但是为什么呢?
declare let foo: Function;
declare let bar: (...args: any[]) => any;
bar = foo;
// ~~~
// ^^^
// Type 'Function' is not assignable to type '(...args: any[]) => any'.
// Type 'Function' provides no match for the signature '(...args: any[]): any'. (2322)
【问题讨论】:
-
你是对的。我现在在操场上试了一下,确实:它让我在
=> any-typed 变量中使用=> never函数。我会删除我的评论。 -
好的,我当时也删除了我的 cmets。还是谢谢!
标签: typescript types