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:
Tom B
2020-02-25 19:40:03 -05:00
committed by GitHub
parent 4872b8c4d6
commit 71f3a59bbb
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -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() });