Answer the question
In order to leave comments, you need to log in
How to fix typing?
On the stackblitz service, I wrote the simplest service that receives an array of users.
LIVE DEMO
Everything is ok, everything works. But after I export the project from this service and run it on my laptop, the following errors appear in the console:
ERROR in src/app/app.component.ts(22,9): error TS2322: Type 'Placeholder' is not assignable to type 'Placeholder[]'.
Property 'length' is missing in type 'Placeholder'.
src/app/data.service.ts(16,5): error TS2322: Type 'Observable<Object>' is not assignable to type 'Observable<Placeholder>'.
Type 'Object' is not assignable to type 'Placeholder'.
The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?
Property 'id' is missing in type 'Object'.
Answer the question
In order to leave comments, you need to log in
getHttpData(): Observable<Placeholder[]> {
return this.httpClient.get<Placeholder[]>(this.httpDataUrl);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question