mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
Fix tough-cookie Cookie field typings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { JSDOM, VirtualConsole, CookieJar, FromUrlOptions, FromFileOptions, DOMWindow, ResourceLoader, FetchOptions } from 'jsdom';
|
||||
import { JSDOM, VirtualConsole, CookieJar, FromUrlOptions, FromFileOptions, DOMWindow, ResourceLoader, FetchOptions, ConstructorOptions } from 'jsdom';
|
||||
import { CookieJar as ToughCookieJar, MemoryCookieStore } from 'tough-cookie';
|
||||
import { Script } from 'vm';
|
||||
|
||||
@@ -56,8 +56,9 @@ function test_cookieJar() {
|
||||
const store = {} as MemoryCookieStore;
|
||||
const options = {} as ToughCookieJar.Options;
|
||||
|
||||
const cookieJar = new CookieJar(store, options);
|
||||
const dom = new JSDOM(``, { cookieJar });
|
||||
const cookieJar: CookieJar = new CookieJar(store, options);
|
||||
const constructorOptions: ConstructorOptions = { cookieJar };
|
||||
const dom = new JSDOM(``, constructorOptions);
|
||||
}
|
||||
|
||||
function test_beforeParse() {
|
||||
|
||||
@@ -14,7 +14,6 @@ let strOrTrueOrUndef: string | true | undefined;
|
||||
const buffer: Buffer = new Buffer('foo');
|
||||
let num = 0;
|
||||
let bool: boolean;
|
||||
let date: Date;
|
||||
let obj: object;
|
||||
const dest = 'foo';
|
||||
|
||||
@@ -58,8 +57,8 @@ obj = req.toJSON();
|
||||
let cookie: request.Cookie = request.cookie('foo')!;
|
||||
str = cookie.key;
|
||||
str = cookie.value;
|
||||
date = cookie.expires;
|
||||
str = cookie.path;
|
||||
const expires: Date | 'Infinity' = cookie.expires;
|
||||
const cpath: string | null = cookie.path;
|
||||
str = cookie.toString();
|
||||
bool = cookie.httpOnly;
|
||||
|
||||
|
||||
Vendored
+5
-7
@@ -73,18 +73,16 @@ export class Cookie {
|
||||
|
||||
constructor(properties?: Cookie.Properties);
|
||||
|
||||
// TODO: Some of the following properties might actually be nullable.
|
||||
|
||||
key: string;
|
||||
value: string;
|
||||
expires: Date;
|
||||
expires: Date | 'Infinity';
|
||||
maxAge: number | 'Infinity' | '-Infinity';
|
||||
domain: string;
|
||||
path: string;
|
||||
domain: string | null;
|
||||
path: string | null;
|
||||
secure: boolean;
|
||||
httpOnly: boolean;
|
||||
extensions: string[];
|
||||
creation: Date;
|
||||
extensions: string[] | null;
|
||||
creation: Date | null;
|
||||
creationIndex: number;
|
||||
|
||||
hostOnly: boolean | null;
|
||||
|
||||
Reference in New Issue
Block a user