【发布时间】:2018-03-15 03:34:51
【问题描述】:
我有这个功能:
function proc(unames: Array<string>){}
我尝试通过它:
import _ = require('lodash');
const usernames = _.flattenDeep([unames]).filter(function (item, index, arr) {
return item && arr.indexOf(item) === index;
});
const recipient = 'foobarbaz';
proc(usernames.concat(recipient));
我收到此错误:
有人知道如何缓解这种情况吗?
我试过这个,我得到一个更长更疯狂的错误:
function proc(unames: Array<string | ReadonlyArray<string>>){}
但是,这使错误消失了:
function proc(unames: Array<string | ReadonlyArray<any>>){}
不太清楚发生了什么。
【问题讨论】:
标签: node.js typescript lodash typescript2.0 tsc