-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix(types): manually Pick and Omit from CookieSerializeOptions
interface
#10767
Conversation
🦋 Changeset detectedLatest commit: ad76a00 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use a partial + a mapped type to allow undefined (maybe there's one built-in TS?) instead? Having to maintain the jsdoc annotations is not ideal imo. We also probably want to do this for the get options
We could but users lose typedocs that way. I don't think maintainability is much of a concern for this part of the codebase, it's very low traffic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good comprise, especially if the file is rarely modified.
I guess it's superseded by #10776? |
CookieSerializeOptions, | ||
'domain' | 'path' | 'expires' | 'maxAge' | 'httpOnly' | 'sameSite' | 'secure' | 'encode' | ||
>; | ||
// `AstroCookieSetOptions` and `AstroCookieDeleteOptions` are manually copied subsections of `CookieSerializeOptions` because `Omit` and `Pick` result in all fields being required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason it cannot be Partial<Pick...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because jsdoc annotations are lost anyway
Closing since it seems like this is not relevant anymore with the PR Florian linked. |
Changes
Astro.cookies.set
andAstro.cookies.delete
were incorrectly reported as required.Testing
Docs