类型的参数'(_ spaceService_:any)=>任何'不能转让给

时间:2017-10-07 17:07:25

标签: javascript jquery html angularjs typescript

嘿如果我在我的代码库中更新下面的代码我收到以下错误,你能告诉我如何解决它...提供我的代码和错误下面

let spaceService;
            beforeEach(inject(function(_spaceService_, ''){
                spaceService = _spaceService_
            ));

Argument of type '(_spaceService_: any) => any' is not assignable to pramter of type 'any[]'.

物业'推动'类型'( spaceService :any)=>任何'

1 个答案:

答案 0 :(得分:1)

问题在于,由于某种原因(可能来自代码的不同部分),变量spaceService是一个数组,您需要将代码更改为以下内容:

let spaceService; 
// if it is not initiated you should use:
//let spaceService: any[] = new array[];
            beforeEach(inject(function(_spaceService_, ''){
                spaceService.push(_spaceService_);
            ));