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

extendType with objectTypes other than "Query" or "Mutation" #294

Closed
nayaabkhan opened this issue Oct 30, 2019 · 1 comment
Closed

extendType with objectTypes other than "Query" or "Mutation" #294

nayaabkhan opened this issue Oct 30, 2019 · 1 comment

Comments

@nayaabkhan
Copy link

nayaabkhan commented Oct 30, 2019

Is extendType expected to support extending custom types? I am trying to do this:

export const User = objectType({
  name: 'User',
  description: 'Represents a User.',
  definition(t) {
    t.implements(Node)
  },
})

export const AddInbox = extendType({
  type: 'User',
  definition(t) {
    // ...
  }
})

But TypeScript complains:

Type 'NexusObjectTypeDef<"User">' is not assignable to type '"Query" | "Mutation"'. Type 'NexusObjectTypeDef<"User">' is not assignable to type '"Mutation"'.
@nayaabkhan
Copy link
Author

Sorry for the false alarm, was able to fix the issue by running my development server with transpile flag as suggested here: prisma-labs/graphql-framework-experiment#77 (comment).

Leaving here in case someone else comes looking for help:

{
  "scripts": {
    "develop": "ts-node-dev --no-notify --transpile-only --respawn ./src/index.ts"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant