-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
@supabase/ssr
should include @types/cookie
as a (non-dev) dependency
#53
Comments
Transferred to auth for the right eyes. PRs welcome as well! |
I've created a PR over at @supabase/auth-helpers: Thank you @dawaltconley for figuring this out as it was a bit of a head scratcher for me! |
Had the same issue and could not work it out - thanks @dawaltconley ! |
Ran into this issue today and was banging my head against the wall for a while. For those who are unsure of the solution:
|
Hey everyone, Thanks for the feedback. I can relate to the issue of having to manually install the types package and potentially doing some head scratching if one does not install it. However, my understanding is that types generally live as dev dependencies by convention and listing it as a prod dependency instead would force users to opt in even if they do not need the types Leaving it as a dev dependency provides more optionality and I'm currently in favour of that. I think we can look into better documenting this on the SSR guide I'll also check in with the team to see what they think. In the meantime let us know if there are any questions/concerns or more arguments for/against inclusion. Thanks |
For what it's worth, I do not think the convention on this is very clear or well-established, but I've seen more recommendations for library authors to install any exposed type dependencies as non-dev than dev (see here and here). The most contentious case is In my view, every Typescript project already ships types to all users via declaration files, whether they use them or not. Unless you go pure JavaScript, it's really a choice between shipping complete vs incomplete types to all users. I know it's "one more dependency," but type packages are very small and usually (as in this case) 0 deps. But I can't claim that's a universal view. Including |
Hey, We've decided to include it. Thanks! |
Makes the `@types/cookies` dependency a regular one to fix common compilation errors. See #53.
Bug report
Describe the bug
The server client example for NextJS setups throws errors with stricter TS/ESLint configs (specifically with the
@typescript-eslint/no-unsafe-argument
rule):It's not immediately obvious when trying to debug but
{ name, value, ...options }
evaluates toany
. This is becauseCookieOptions
is an alias for a type provided by the@types/cookie
package, but this is a devDependency, so it's not being installed with@supabase/ssr
:As is,
CookieOptions
is basically an obscuredany
type, which only makes the type issues harder to debug.To Reproduce
Attempt to use the server client example in any project with
@typescript-eslint/no-unsafe-argument
set toerror
.Expected behavior
This can be fixed by adding
@types/cookie
to a project manually, but it would be better to include the package with@supabase/ssr
.The text was updated successfully, but these errors were encountered: