API

interfaceType

interfaceType

GraphQL Docs for Interface Types

In Nexus, you do not need to redefine the interface fields on the implementing object types, instead you may use .implements(interfaceName) and all of the interface fields will be added to the type.

1const Node = interfaceType({
2 name: 'Node',
3 definition(t) {
4 t.id('id', { description: 'GUID for a resource' })
5 },
6})
7
8const User = objectType({
9 name: 'User',
10 definition(t) {
11 t.implements('Node')
12 },
13})

If you need to modify the description or resolver defined by an interface, you can call the modify method on objectType to change these after the fact.

Edit this page on Github