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

outdated dependency @types/cookie causes type mismatch #690

Open
brumm opened this issue Jan 12, 2024 · 1 comment
Open

outdated dependency @types/cookie causes type mismatch #690

brumm opened this issue Jan 12, 2024 · 1 comment

Comments

@brumm
Copy link

brumm commented Jan 12, 2024

Hey there,

I'm seeing a TS error when passing Nextjs's cookies() function to getIronSession

Argument of type 'ReadonlyRequestCookies' is not assignable to parameter of type 'CookieStore'.
  Types of property 'set' are incompatible.
    Type '(...args: [key: string, value: string, cookie?: Partial<ResponseCookie> | undefined] | [options: ResponseCookie]) => ResponseCookies' is not assignable to type '{ (name: string, value: string, cookie?: Partial<ResponseCookie> | undefined): void; (options: ResponseCookie): void; }'.
      Types of parameters 'args' and 'name' are incompatible.
        Type '[name: string, value: string, cookie?: Partial<ResponseCookie> | undefined]' is not assignable to type '[key: string, value: string, cookie?: Partial<ResponseCookie> | undefined] | [options: ResponseCookie]'.
          Type '[name: string, value: string, cookie?: Partial<ResponseCookie> | undefined]' is not assignable to type '[key: string, value: string, cookie?: Partial<ResponseCookie> | undefined]'.
            Type at position 2 in source is not compatible with type at position 2 in target.
              Type 'Partial<ResponseCookie> | undefined' is not assignable to type 'Partial<import("/Users/brumm/Code/portals/node_modules/next/dist/compiled/@edge-runtime/cookies/index").ResponseCookie> | undefined'.
                Type 'Partial<ResponseCookie>' is not assignable to type 'Partial<import("/Users/brumm/Code/portals/node_modules/next/dist/compiled/@edge-runtime/cookies/index").ResponseCookie>'.
                  Types of property 'priority' are incompatible.
                    Type 'unknown' is not assignable to type '"low" | "medium" | "high" | undefined'.ts(2345)

It seems like the priority attribute has been added to the types in @types/cookie@0.6.0, but this library is still on 0.5.4

@aryaadinulfadlan
Copy link

aryaadinulfadlan commented Mar 24, 2024

Hey there,

I'm seeing a TS error when passing Nextjs's cookies() function to getIronSession

Argument of type 'ReadonlyRequestCookies' is not assignable to parameter of type 'CookieStore'.
  Types of property 'set' are incompatible.
    Type '(...args: [key: string, value: string, cookie?: Partial<ResponseCookie> | undefined] | [options: ResponseCookie]) => ResponseCookies' is not assignable to type '{ (name: string, value: string, cookie?: Partial<ResponseCookie> | undefined): void; (options: ResponseCookie): void; }'.
      Types of parameters 'args' and 'name' are incompatible.
        Type '[name: string, value: string, cookie?: Partial<ResponseCookie> | undefined]' is not assignable to type '[key: string, value: string, cookie?: Partial<ResponseCookie> | undefined] | [options: ResponseCookie]'.
          Type '[name: string, value: string, cookie?: Partial<ResponseCookie> | undefined]' is not assignable to type '[key: string, value: string, cookie?: Partial<ResponseCookie> | undefined]'.
            Type at position 2 in source is not compatible with type at position 2 in target.
              Type 'Partial<ResponseCookie> | undefined' is not assignable to type 'Partial<import("/Users/brumm/Code/portals/node_modules/next/dist/compiled/@edge-runtime/cookies/index").ResponseCookie> | undefined'.
                Type 'Partial<ResponseCookie>' is not assignable to type 'Partial<import("/Users/brumm/Code/portals/node_modules/next/dist/compiled/@edge-runtime/cookies/index").ResponseCookie>'.
                  Types of property 'priority' are incompatible.
                    Type 'unknown' is not assignable to type '"low" | "medium" | "high" | undefined'.ts(2345)

It seems like the priority attribute has been added to the types in @types/cookie@0.6.0, but this library is still on 0.5.4

hello sir. I got the same error.
how do you solve that?

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

2 participants