question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need help for two issues

See original GitHub issue

Hey bro,

I do love this package. It’s amazing and can help me a lot. But I have two issues when using this package with typescript.

First issue: I have some queries like

mutation logout {
	logout @client {
		success
	}
}

Error:

GraphQL Error: Unknown directive "client".

Looks like the generator does not like “@client” syntax. But another generator can generate the code correctly.

Second issue:

	export function HOC<TProps = {}>(
		operationOptions?: ReactApollo.OperationOption<TProps, Query, Variables>
	) {
		return ReactApollo.graphql<TProps, Query, Variables>(
			Document,
			operationOptions
		);
	}

The HOC is generated correctly but with a type error for operationOptions. It’s happening on all queries.

The type error is:

Argument of type 'OperationOption<TProps, Query, Variables, ChildProps<TProps, Query, Variables>> | undefined' is not assignable to parameter of type 'OperationOption<TProps, Query, Variables, Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>> | undefined'.
  Type 'OperationOption<TProps, Query, Variables, ChildProps<TProps, Query, Variables>>' is not assignable to type 'OperationOption<TProps, Query, Variables, Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>>'.
    Types of property 'props' are incompatible.
      Type '((props: OptionProps<TProps, Query, Variables>, lastProps?: void | ChildProps<TProps, Query, Variables> | undefined) => ChildProps<TProps, Query, Variables>) | undefined' is not assignable to type '((props: OptionProps<TProps, Query, Variables>, lastProps?: void | (Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>) | undefined) => Partial<...> & Partial<...>) | undefined'.
        Type '(props: OptionProps<TProps, Query, Variables>, lastProps?: void | ChildProps<TProps, Query, Variables> | undefined) => ChildProps<TProps, Query, Variables>' is not assignable to type '(props: OptionProps<TProps, Query, Variables>, lastProps?: void | (Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>) | undefined) => Partial<...> & Partial<...>'.
          Types of parameters 'lastProps' and 'lastProps' are incompatible.
            Type 'void | (Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>) | undefined' is not assignable to type 'void | ChildProps<TProps, Query, Variables> | undefined'.
              Type 'Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>' is not assignable to type 'void | ChildProps<TProps, Query, Variables> | undefined'.
                Type 'Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>' is not assignable to type 'ChildProps<TProps, Query, Variables>'.
                  Type 'Partial<DataProps<Query, Variables>> & Partial<MutateProps<Query, Variables>>' is not assignable to type 'TProps'.

Please fell free to point out what I did wrong or what I can do to fix them. I really want to use it 😃

Thanks again for everyone’s effort to build this handy package 👍

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Xamplecommented, Jul 15, 2019

For the @client support, you can add this following line to any .graphql file containing your schema: directive @client(always: Boolean) on FIELD This will let the compiler know you can use a directive @client and that this directive can take a boolean always.

1reaction
valerybugakovcommented, Oct 10, 2018

@ardatan you’re right, the latest version of the react-apollo-template fixes the issue for me, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find Immediate Homelessness Assistance - SAMHSA
Use these free helplines, directories, and support organizations for assistance with homelessness, domestic violence, or mental health issues.
Read more >
Financial Assistance for Food, Housing, and Bills | USAGov
Get help from government programs that are offering temporary COVID-19 assistance to pay rent, funeral reimbursement, and student loans.
Read more >
NIMH » Help for Mental Illnesses
If you or someone you know has a mental illness, there are ways to get help. Use these resources to find help for...
Read more >
HelpGuide.org
Millions of readers rely on HelpGuide for free, evidence-based resources to understand and navigate mental health challenges. Please donate today to help us ......
Read more >
Emergency Rental Assistance Program - Treasury Department
To meet this need, the Emergency Rental Assistance program makes funding available to assist households that are unable to pay rent or utilities....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found