寂寞火

文章
9
资源
0
加入时间
4年1月24天

Ts报错:Type ‘Function | undefined‘ is not assignable to type ‘Function‘;Cannot invoke an object

报错Type ‘Function | undefined’ is not assignable to type ‘Function’.Type ‘undefined’ is not assignable to type ‘Function’.意思是:类型’Function | undefined’不能赋值给类型’Function’。类型’undefined’不能赋值给类型’Function’。解决:将类型定义为Function | undefined const myFun: Function