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

GraphQL Shield and Relay Plugins #826

Closed
matthawk60 opened this issue Mar 6, 2023 · 2 comments
Closed

GraphQL Shield and Relay Plugins #826

matthawk60 opened this issue Mar 6, 2023 · 2 comments

Comments

@matthawk60
Copy link
Sponsor

When using these two plugins together I get a type error on relayOptions

Type '{ clientMutationId: "omit"; cursorType: "ID"; }' is missing the following properties from type '{ idFieldName?: string; idFieldOptions?: Partial<Omit<ObjectFieldOptions<ExtendDefaultTypes<{ Scalars: { DateTime: { Input: Date; Output: Date; }; ID: { Output: string | number; Input: string; }; }; PrismaTypes: PrismaTypes; }>, ... 4 more ..., PageInfoShape>, "args" | ... 2 more ... | "nullable">>; ... 29 more ...;...': nodeQueryOptions, nodesQueryOptionsts(2739)

Using @ts-ignore allows it to function correctly. The error goes away when I remove the GraphQL Shield plugin. I copied the plugin exactly as in your example.

@hayes
Copy link
Owner

hayes commented Mar 6, 2023

The plugin as written makes the shield option required for query and mutation fields. You can either update the plugin to make these options, or you can define the required options for the node/nodes fields by adding node(s)QueryOptions to relayOptions

@matthawk60
Copy link
Sponsor Author

Thanks that worked great.

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

2 participants