Open radromanov opened 1 year ago
Just bumped into this issue myself. Resolved it by doing as specified in https://github.com/graphql-nexus/nexus/issues/816#issuecomment-772824518, putting it into makeSchema
's types.
In your case it will probably be enough to export both LoginSuccess
and LoginError
(maybe also LoginResult
)
Hello guys,
I've been learning Nexus and I've been trying to implement a
unionType
that returns either aLoginSuccess
, with its respective fields, or aLoginError
-- the implementation could be applied to any other context, I suppose. However, I keep running into an error, and I can't wrap my head around it:LoginSuccess
is anobjectType
as seen below, so how come Nexus doesn't recognize it as such?The code in question:
I am also exporting the type, and importing it into my schema:
My
package.json
dependencies:I could be overlooking something really simple here, but any help with this would be very much appreciated!
Thank you.