mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
js-cookie: last review fixes #32830
This commit is contained in:
parent
08a32bb403
commit
dfd742bfd2
4
types/js-cookie/index.d.ts
vendored
4
types/js-cookie/index.d.ts
vendored
@ -79,7 +79,7 @@ declare namespace Cookies {
|
||||
* or SDK. Note: The noConflict method is not necessary when using
|
||||
* AMD or CommonJS, thus it is not exposed in those environments.
|
||||
*/
|
||||
noConflict?(): CookiesStatic;
|
||||
noConflict?(): CookiesStatic<T>;
|
||||
|
||||
/**
|
||||
* Create a new instance of the api that overrides the default
|
||||
@ -88,7 +88,7 @@ declare namespace Cookies {
|
||||
* will run the converter first for each cookie. The returned
|
||||
* string will be used as the cookie value.
|
||||
*/
|
||||
withConverter(converter: CookieReadConverter | { write: CookieWriteConverter<T>; read: CookieReadConverter; }): CookiesStatic;
|
||||
withConverter<TConv extends object>(converter: CookieReadConverter | { write: CookieWriteConverter<TConv>; read: CookieReadConverter; }): CookiesStatic<TConv>;
|
||||
}
|
||||
|
||||
type CookieWriteConverter<T extends object> = (value: string | T, name: string) => string;
|
||||
|
||||
@ -40,7 +40,7 @@ cookies.get('escaped');
|
||||
Cookies.defaults.path = '';
|
||||
delete Cookies.defaults.path;
|
||||
|
||||
const PHPCookies = Cookies.withConverter({
|
||||
const PHPCookies = Cookies.withConverter<object>({
|
||||
write(value) {
|
||||
value; // $ExpectType string | object
|
||||
return encodeURIComponent(value as string)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user