mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Fix js-cookie types (#42483)
* Update js-cookie types Calls to set return a string or undefined, not void, as seen here: https://github.com/js-cookie/js-cookie/blob/master/src/api.mjs#L7 https://github.com/js-cookie/js-cookie/blob/master/src/api.mjs#L47 * Update js-cookie tests
This commit is contained in:
2
types/js-cookie/index.d.ts
vendored
2
types/js-cookie/index.d.ts
vendored
@@ -57,7 +57,7 @@ declare namespace Cookies {
|
||||
/**
|
||||
* Create a cookie
|
||||
*/
|
||||
set(name: string, value: string | T, options?: CookieAttributes): void;
|
||||
set(name: string, value: string | T, options?: CookieAttributes): string | undefined;
|
||||
|
||||
/**
|
||||
* Read cookie
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Cookies = require("js-cookie");
|
||||
|
||||
// $ExpectType string | undefined
|
||||
Cookies.set('name', 'value');
|
||||
Cookies.set('name', 'value', { expires: 7 });
|
||||
Cookies.set('name', 'value', { expires: new Date() });
|
||||
|
||||
Reference in New Issue
Block a user