TS2322: Type 'any[]' is not assignable to type 'never[]'
Смотрю учебный материал по Angular, добавляю код в свой проект
products = [];
constructor(private dataService: DataService) { }
ngOnInit(){
this.dataService.sendGetRequest().subscribe((data: any[])=>{
console.log(data);
this.products = data;
})
}
И тут же IDEA выдает две ошибки:
this.dataService.sendGetRequest().subscribe((data: any[])=>{
TS2769: No overload matches this call. Overload 1 of 5, '(observer?: PartialObserver<Object> | undefined): Subscription', gave the following error. Argument of type '(data: any[]) => void' is not assignable to parameter of type 'PartialObserver<Object> | undefined'. Property 'complete' is missing in type '(data: any[]) => void' but required in type 'CompletionObserver<Object>'. Overload 2 of 5, '(next?: ((value: Object) => void) | undefined, error?: ((error: any) => void) | undefined, complete?: (() => void) | undefined): Subscription', gave the following error. Argument of type '(data: any[]) => void' is not assignable to parameter of type '(value: Object) => void'. Types of parameters 'data' and 'value' are incompatible. The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead? Type 'Object' is missing the following properties from type 'any[]': length, pop, push, concat, and 26 more.
this.products = data;
TS2322: Type 'any[]' is not assignable to type 'never[]'.
В чем тут проблема?