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

GooglePhotosPicker causing Typescript 2345 error, "Types of parameters 'uppy' and 'uppy' are incompatible." #5547

Closed
2 tasks done
Tracked by #5532
argotechnica opened this issue Dec 12, 2024 · 5 comments · Fixed by #5550
Closed
2 tasks done
Tracked by #5532
Labels

Comments

@argotechnica
Copy link

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

  • Install latest Uppy packages
  • Instantiate Uppy and add GooglePhotosPicker using boilerplate code as follows:
import GooglePhotosPicker from '@uppy/google-photos-picker';
import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit';

...

        .use(GooglePhotosPicker, {
          companionUrl: COMPANION_URL,
          companionAllowedHosts: COMPANION_ALLOWED_HOSTS,
          clientId: 'From Google Developer Console',
        })

Encountered while using Typescript 5.4.5, tried upgrading to 5.7.2 with no change in behavior

Expected behavior

No Typescript errors

Actual behavior

Typescript error:

Argument of type 'typeof GooglePhotosPicker' is not assignable to parameter of type '{ new (uppy: Uppy<Meta, Record<string, never>>, opts?: any): BasePlugin<any, Meta, Record<string, never>, Record<string, unknown>>; prototype: BasePlugin<...>; }'.
  Types of construct signatures are incompatible.
    Type 'new <M extends Meta & { width: number; height: number; }, B extends Body>(uppy: Uppy<M, B>, opts: GooglePhotosPickerOptions) => GooglePhotosPicker<M, B>' is not assignable to type 'new (uppy: Uppy<Meta, Record<string, never>>, opts?: any) => BasePlugin<any, Meta, Record<string, never>, Record<string, unknown>>'.
      Types of parameters 'uppy' and 'uppy' are incompatible.
        Type 'Uppy<Meta, Record<string, never>>' is not assignable to type 'Uppy<Meta & { width: number; height: number; }, Record<string, never>>'.
          The types of 'opts.meta' are incompatible between these types.
            Type 'Meta' is not assignable to type 'Meta & { width: number; height: number; }'.
              Type 'Meta' is missing the following properties from type '{ width: number; height: number; }': width, height ts(2345)

GooglePhotosPicker extends Meta to require width and height:

export default class GooglePhotosPicker<
    M extends Meta & { width: number; height: number },

Found someone in community forum reporting this too (not me) but there's been no discussion there: https://community.transloadit.com/t/googlephotospicker-ts-error/17382

@benooon
Copy link

benooon commented Dec 12, 2024

This issue is supper urgent, in March 31, 2025. google will stop support library API.
so all users will need to start migrate immediately
https://developers.googleblog.com/en/google-photos-picker-api-launch-and-library-api-updates/

@mifi
Copy link
Contributor

mifi commented Dec 14, 2024

what does your tsconfig.json look like?

@argotechnica
Copy link
Author

Thanks @mifi , mine looks like this:

{
  "compilerOptions": {
    "baseUrl": "./src/",
    "target": "es6",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    "src/lib/aws/temp.js"
  ],
  "exclude": ["node_modules", "supabase/functions"]
}

@mifi mifi mentioned this issue Dec 14, 2024
12 tasks
@mifi
Copy link
Contributor

mifi commented Dec 14, 2024

Which line is the error on?

@yoslupa
Copy link

yoslupa commented Dec 15, 2024

.use(GooglePhotosPicker, { ---  here I'm getting  the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants