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

req and res types are not compatible #61

Open
mateuszpigula opened this issue Jan 10, 2024 · 1 comment
Open

req and res types are not compatible #61

mateuszpigula opened this issue Jan 10, 2024 · 1 comment

Comments

@mateuszpigula
Copy link

mateuszpigula commented Jan 10, 2024

I can't pass req as param, why is that?

export const someFunction = (
  req: NonNullable<Parameters<typeof getCookie>[1]>['req'],
) => {
  return getCookie('key', { req }); // req ts error
}
Type '(IncomingMessage & { cookies?: TmpCookiesObj | undefined; }) | Request | NextRequest | undefined' is not assignable to type 'Request | NextRequest | undefined'.
  Type 'IncomingMessage & { cookies?: TmpCookiesObj | undefined; }' is not assignable to type 'Request | NextRequest | undefined'.
    Type 'IncomingMessage & { cookies?: TmpCookiesObj | undefined; }' is missing the following properties from type 'NextRequest': geo, ip, nextUrl, page, and 20 more.ts(2322)

Using req: OptionsType['req'], gives me exactly the same error

@JonasDoe
Copy link

JonasDoe commented Jul 10, 2024

Facing the same issue. Declaring and passing NonNullable<Parameters<typeof getCookie>[1]> would work, though, but that's not the same.

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