diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index 1420723b8d..0b8be95052 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -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() { diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index 1d13dcbaaa..66163d5863 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -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; diff --git a/types/tough-cookie/index.d.ts b/types/tough-cookie/index.d.ts index e68496d302..c432e01aa2 100644 --- a/types/tough-cookie/index.d.ts +++ b/types/tough-cookie/index.d.ts @@ -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;