-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Expect value of type error using ObjectType inheritance #73
Comments
Please crate a repository with minimal amount of code to reproduce the issue. |
I'm debugging the |
Maybe your query return type is an interface/union and you forget to return instance of the object type class? 😕 |
Oh my.... That error happened only when I started using inheritance. Now I have to rewrite all the code from
|
https://19majkel94.github.io/type-graphql/docs/interfaces-and-inheritance.html
TypeGraphQL checks the underlying object type by using |
Is it best to implement |
I would even recommend creating your own helper function: function toObjectType<T>(Type: new (...args: any[]) => T, object: T) {
return Object.assign(new Type(), object);
} Then use it: @Query(return => MyInterface) {
return toObjectType(MyType, {
whoLetTheDogsOut: "WHO? WHO? WHO? WHO?",
});
}
|
I couldn't get inheritance to work with ObjectType():
There's no error when the server starts, but it will throw this error when fetching the list data:
Not using the inheritance make things work again.
The text was updated successfully, but these errors were encountered: