mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
[cookies] Fix Cookies.set signature for omittingvalue (#38400)
* [cookies] Added breaking test for Cookies.set * [cookies] Fix Cookies.set sig for omitting `value` When omitting the `value` parameter the signature assumes you have omitted the `opts` parameter and causes an error because the types don't match
This commit is contained in:
committed by
Daniel Rosenwasser
parent
569992f619
commit
e3a3f18d94
@@ -26,6 +26,9 @@ const server = http.createServer((req, res) => {
|
||||
.set("tampered", "baz")
|
||||
.set("tampered.sig", "bogus")
|
||||
|
||||
// delete cookie but pass options
|
||||
.set("removed", { signed: true })
|
||||
|
||||
// sameSite option
|
||||
.set("samesite", "same", {sameSite: 'lax'})
|
||||
.set("samesite", "same", {sameSite: 'strict'})
|
||||
|
||||
Vendored
+2
-1
@@ -29,7 +29,8 @@ interface Cookies {
|
||||
* the current context to allow chaining.If the value is omitted,
|
||||
* an outbound header with an expired date is used to delete the cookie.
|
||||
*/
|
||||
set(name: string, value?: string, opts?: Cookies.SetOption): this;
|
||||
set(name: string, value: string, opts?: Cookies.SetOption): this;
|
||||
set(name: string, opts?: Cookies.SetOption): this;
|
||||
}
|
||||
|
||||
declare namespace Cookies {
|
||||
|
||||
Reference in New Issue
Block a user