question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interface resolveType is not optional

See original GitHub issue

It should be possible to define:

export const UserError = interfaceType({
  definition(t) {
    t.string('id')
  },
  name: 'UserError',
})

But I get an error:

Argument of type '{ definition(t: InterfaceDefinitionBlock<"UserError">): void; name: "UserError"; }' is not assignable to parameter of type 'NexusInterfaceTypeConfig<"UserError">'.
  Property 'resolveType' is missing in type '{ definition(t: InterfaceDefinitionBlock<"UserError">): void; name: "UserError"; }' but required in type '{ resolveType: AbstractTypeResolver<"UserError">; }'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
evanmcdcommented, Oct 7, 2021

Well, I seem to have found it pretty quickly after all. Adding this to the config object of makeSchema()

features: {
      abstractTypeStrategies: {
        resolveType: false
      }     
    }
0reactions
evanmcdcommented, Oct 7, 2021

I’m getting this error now and wondering what the correct fix for it is. Does anyone have one?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Abstract Types - GraphQL Nexus
This guide covers the topic of GraphQL Union types and Interface types. You will learn how Nexus ... resolveType field will be required,...
Read more >
Unions and interfaces - Apollo GraphQL Docs
Unions and interfaces are abstract GraphQL types that enable a schema field to return ... All of a union's included types must be...
Read more >
How to add a `resolveType` to GraphQL? - Stack Overflow
Only thing, I have no idea where to insert or execute the resolver function... I'm using graphql-tools and not apollo, if that helps....
Read more >
Documentation - Advanced Types - TypeScript
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >
Union & Interface Types - Join Monster
... not contain the "$type" (as it was not requested in the GraphQL query), so we cannot yet reference it in resolveType ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found