typescript - 传递要在 Typescript 中应用的参数数组
问题描述
解决方案:
private compiledFn: Maybe<(data: any) => void> = null;
我只想使用传递我的参数数组apply
// function... I can see there is a problem here
private compiledFn: Maybe<() => void> = null;
// calling with apply
let arg = [data];
return this.compiledFn.apply(data, arg);
但是得到这个错误:
semantic error TS2345 Argument of type 'any[]' is not assignable to parameter of type '[]'.
Types of property 'length' are incompatible.
Type 'number' is not assignable to type '0'.
解决方案
推荐阅读
- docker - 监控 Docker 容器中的主机
- python - 如何处理外部库中的输入不足?
- javascript - 如何使用条件设置 v-layout v-select 样式?
- python - LDA 可视化 [import_optional_dependency() 得到了一个意外的关键字参数“错误”]
- javascript - 关闭菜单后如何将汉堡图标放在首位
- javascript - 错误“找不到分隔符,发现意外数据。尾随数据”
- string - 如何在 Erlang 中将重音字符串转换为常规字符串?
- sql-server - 机器生成的许多 odb 文件将其数据导出到 SQL Server 数据库
- java - 在配置的最大连接数连接后,如何防止传入连接的 Akka TCP 流连接?
- listview - 刷卡删除recyclerview中的行