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 error on param flow: 'auth-code' #374

Open
andrepadez opened this issue Dec 21, 2024 · 0 comments
Open

Typescript error on param flow: 'auth-code' #374

andrepadez opened this issue Dec 21, 2024 · 0 comments

Comments

@andrepadez
Copy link

I have been using this code, and it works, for a long time.

const onConnect = useGoogleLogin({
    flow: 'auth-code',
    accessType: 'offline',
    scope: [
      'https://www.googleapis.com/auth/analytics.readonly',
      'https://www.googleapis.com/auth/analytics.edit',
      'https://www.googleapis.com/auth/userinfo.profile',
      'https://www.googleapis.com/auth/userinfo.email',
    ].join(' '),
    onSuccess: async (codeResponse: any) => {
      await ganClient.post('/google-oauth/connect', codeResponse);
      queryClient.invalidateQueries({ queryKey: ['GOOGLE_OAUTH_ACCOUNTS'] });
    },
  });

I am now migrating my project to typescript and i get this error that i can't figure out:

src/state/googleAnalytics/useGoogleAccounts.ts:22:21 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(options: UseGoogleLoginOptionsImplicitFlow): (overrideConfig?: OverridableTokenClientConfig | undefined) => void', gave the following error.
    Type '"auth-code"' is not assignable to type '"implicit"'.
  Overload 2 of 2, '(options: UseGoogleLoginOptionsAuthCodeFlow): () => void', gave the following error.
    Object literal may only specify known properties, and 'accessType' does not exist in type 'UseGoogleLoginOptionsAuthCodeFlow'.

22   const onConnect = useGoogleLogin({
                       ~~~~~~~~~~~~~~

  ../../node_modules/@react-oauth/google/dist/index.d.ts:360:5
    360     flow?: 'implicit';
            ~~~~
    The expected type comes from property 'flow' which is declared here on type 'UseGoogleLoginOptionsImplicitFlow'

It still works, if i use //@ts-ignore.

Not sure how to get past this.

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