You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/schema.ts:14:7 - error TS2322: Type '(rootValue: any, args: { message: string; }) => string' is not assignable to type 'GraphQLFieldResolver<any, any, { [argName: string]: any; }>'.
Types of parameters 'args' and 'args' are incompatible.
Property 'message' is missing in type '{ [argName: string]: any; }' but required in type '{ message: string; }'.
14 resolve(rootValue, args: { message: string }) {
~~~~~~~
src/schema.ts:14:34
14 resolve(rootValue, args: { message: string }) {
~~~~~~~
'message' is declared here.
node_modules/graphql/type/definition.d.ts:519:3
519 resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
~~~~~~~
The expected type comes from property 'resolve' which is declared here on type 'GraphQLFieldConfig<any, any, { [argName: string]: any; }>'
Found 1 error.
If the type of args is changed to { message?: string } the problem goes away. But this isn't the correct type since that input field is non-null.
The text was updated successfully, but these errors were encountered:
Using a non-optional type for field arguments is not possible with current TypeScript typings. Here's a small reproduction:
If the type of args is changed to
{ message?: string }
the problem goes away. But this isn't the correct type since that input field is non-null.The text was updated successfully, but these errors were encountered: