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

Typescript: Types of parameters 'info' and 'info' are incompatible. #34

Open
dan-lutd opened this issue Jul 27, 2021 · 0 comments
Open

Comments

@dan-lutd
Copy link

dan-lutd commented Jul 27, 2021

The full error is:

 Type 'IFieldResolver<any, any, any, any>' is not assignable to type 'Resolver<Maybe<any[]>, {}, any, {}> | undefined'.
    Type 'IFieldResolver<any, any, any, any>' is not assignable to type 'ResolverFn<Maybe<any[]>, {}, any, {}>'.
    Types of parameters 'info' and 'info' are incompatible.

    Type 'GraphQLResolveInfo' is not assignable to type 'GraphQLResolveInfo & { mergeInfo?: MergeInfo | undefined;}'.
        Type 'import(" ./node_modules/graphql/type/definition").GraphQLResolveInfo'  assignable to e 'import(" ./node_modules/@types/graphql-resolvers/node_modules/graphql/type/definition").GraphQLResolveInfo'.
        Types of property 'returnType' are incompatible.
            Type 'import(" ./node_modules/graphql/type/definition").GraphQLOutputType' is not assignable to type 'import(" ./node_modules/@types/graphql-resolvers/node_modules/graphql/type/definition").GraphQLOutputType'.

            Type 'GraphQLScalarType' is not assignable to type 'GraphQLOutputType'.
                Type 'GraphQLScalarType' is missing the following properties from type 'GraphQLEnumType': getValues, getValue`

but I thing the first issue is:
Types of parameters 'info' and 'info' are incompatible.

It looks like the Types for info in index.d.ts from the types for your library: https://www.npmjs.com/package/@types/graphql-resolvers Someone must have published them :-) thanks @rwieruch

I tried a simple change to the index.d.ts
export type IFieldResolver<TSource, TContext, TArgs = Record<string, any>, TReturn = any> = ( source: TSource, args: TArgs, context: TContext, info: GraphQLResolveInfo & { mergeInfo?: MergeInfo | undefined } | any, ) => TReturn;
Luis Felipe Zaguini
by adding the | any on the info type
I'm hoping someone who is versatile with this repo and types will be able to help.

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