Skip to content

Commit b4a1c75

Browse files
authored
🤖 Merge PR DefinitelyTyped#71947 feat(jquery.cookie): fix JQueryCookieOptions.expires type by @pistvan
1 parent b5c91ca commit b4a1c75

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎types/jquery.cookie/index.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface JQueryCookieOptions {
44
/**
55
* Define lifetime of the cookie. Value can be a Number which will be interpreted as days from time of creation or a Date object. If omitted, the cookie becomes a session cookie.
66
*/
7-
expires?: any;
7+
expires?: number | Date;
88
/**
99
* Define the path where the cookie is valid. By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior). If you want to make it available for instance across the entire domain use path: '/'. Default: path of page where the cookie was created.
1010
*/

‎types/jquery.cookie/jquery.cookie-tests.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class CookieOptions implements JQueryCookieOptions {
1717

1818
$.cookie("the_cookie", "the_value");
1919

20+
$.cookie("the_cookie", "the_value", { expires: 7 });
21+
22+
$.cookie("the_cookie", "the_value", { expires: new Date() });
23+
24+
// @ts-expect-error
25+
$.cookie("the_cookie", "the_value", { expires: "tomorrow" });
26+
2027
console.log($.cookie("the_cookie"));
2128

2229
var testObject = new TestObject("Hello World", 5);

0 commit comments

Comments
 (0)