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

example for interface-inheritance does not work for implemented fragments #529

Closed
leetmachine opened this issue Jan 31, 2020 · 4 comments
Closed
Labels
Duplicate 🔑 This issue or pull request already exists

Comments

@leetmachine
Copy link

Describe the issue
the example interfaces-inheritance does not work as expected. When running the supplied graphql statements the fragments do not return the additional fields.

Tested on version 0.17 and 0.18.10-beta with no success.
steps to reproduce:

  1. start example/interfaces-inheritance server.
  2. run the supplied addStudent mutation.
  3. run the supplied persons query.
    image

what was expected:
both objects returned are Students, so should have their universityName field present.

code:
https://github.com/MichalLytek/type-graphql/blob/master/examples/interfaces-inheritance/examples.gql

I'm trying to implement the same thing in my own code base but having the same issue. I would really appreciate the update!

@MichalLytek
Copy link
Owner

AFAIK, it's related to #373. Could you confirm that that issue is about the same problem?

@MichalLytek MichalLytek added Need More Info 🤷‍♂️ Further information is requested Question ❔ Not future request, proposal or bug issue labels Jan 31, 2020
@christianvanr
Copy link

christianvanr commented Feb 1, 2020

maybe not usefull, but i had the same problem (due to the orphanized type) and have solved it quit easy like this

@InterfaceType({
  resolveType: value => {
    return value.constructor.name;
  }
})
export abstract class IPerson implements IResource {

@leetmachine
Copy link
Author

@MichalLytek confirmed, looks the solution presented here solved the issue. Thanks!

@MichalLytek
Copy link
Owner

I've added the workaround to the examples in 801a453.
Maybe finding by value.constructor is better than instanceof check 🤔

@MichalLytek MichalLytek added Duplicate 🔑 This issue or pull request already exists and removed Need More Info 🤷‍♂️ Further information is requested Question ❔ Not future request, proposal or bug issue labels Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🔑 This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants