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
Intended outcome:
Trying to migrate to V3 and unlike in V2 the client prop is set as optional, this creates issues in our existing codebase because everywhere I use client is flagged as potentially undefined. I know this is deprecated but for migration purposes I need to use this for the time being.
Actual outcome:
This is a blocker for us, not sure what other actual outcome I can add here.
How to reproduce the issue:
From the types:
export declare type WithApolloClient<P> = P & {
client?: ApolloClient<any>;
};
Versions
3.3.12
The text was updated successfully, but these errors were encountered:
@billsaysthis I’m sorry to hear you’re having trouble with types! I’m trying to track down why the client prop was marked as optional.
In the meantime, I typically try to never let anything like TypeScript get in the way of shipping. If you’re not familiar there are a couple of temporary workarounds you could use to fix this problem:
import{ApolloClient}from"@apollo/client";importtype{WithApolloClient}from"@apollo/client/react/hoc";declareconstw: WithApolloClient<{}>;// option 1: non-null assertion operator constclient1: ApolloClient=w.client!;// option 2: as operatorconstclient2: ApolloClient=w.clientasApolloClient;// or `any`// option 3: @ts-ignore directive// @ts-ignore: fix when this issue is resolved https://github.com/apollographql/apollo-client/issues/7899constclient3: ApolloClient=w.client;
I know it’s non-ideal, but if you’re just trying to upgrade, maybe you can do this for now and fix it later?
Intended outcome:
Trying to migrate to V3 and unlike in V2 the client prop is set as optional, this creates issues in our existing codebase because everywhere I use client is flagged as potentially undefined. I know this is deprecated but for migration purposes I need to use this for the time being.
Actual outcome:
This is a blocker for us, not sure what other actual outcome I can add here.
How to reproduce the issue:
From the types:
Versions
3.3.12
The text was updated successfully, but these errors were encountered: