Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong data types in courses service #42

Open
Poetro opened this issue Dec 1, 2022 · 0 comments
Open

Wrong data types in courses service #42

Poetro opened this issue Dec 1, 2022 · 0 comments

Comments

@Poetro
Copy link

Poetro commented Dec 1, 2022

On

return this.http.get<Course[]>("/api/courses")

it should be

this.http.get<{payload: Course[]}>

so you need to to do additional casting with


as TypeScript would already know the type of the payload, so you can do

map(res => res.payload)

and it would already have the correct type.

Same goes for all the other HTTP requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant