const fArr: Function = Uint32Array;
new fArr(5);代码(上面)工作正常。但打字稿抛出 TS2351 错误。“此表达式不可构造。类型‘Function’没有构造签名”。请帮忙...提前致谢。
1 回答
MMMHUHU
TA贡献1834条经验 获得超8个赞
只需定义一个构造函数类型:
type Constructor<T = any> = new (...args: any[]) => T;
const fArr: Constructor = Uint32Array;
new fArr(5);
添加回答
举报
0/150
提交
取消
