diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index 151f69d70f..8479c100a1 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -96,6 +96,25 @@ export interface Cookie { sameSite: "Strict" | "Lax"; } +export interface DeleteCookie { + name: string; + url?: string; + domain?: string; + path?: string; + secure?: boolean; +} + +export interface SetCookie { + name: string; + value: string; + domain?: string; + path?: string; + expires?: number; + httpOnly?: boolean; + secure?: boolean; + sameSite?: "Strict" | "Lax"; +} + export interface Viewport { width: number; height: number; @@ -359,15 +378,7 @@ export interface Page extends FrameBase { close(): Promise; content(): Promise; cookies(...urls: string[]): Promise; - deleteCookie( - ...cookies: Array<{ - name: string; - url?: string; - domain?: string; - path?: string; - secure?: boolean; - }> - ): Promise; + deleteCookie(...cookies: DeleteCookie[]): Promise; emulate(options: Partial): Promise; emulateMedia(mediaType: 'screen' | 'print' | null): Promise; evaluateHandle( @@ -398,7 +409,7 @@ export interface Page extends FrameBase { screenshot(options?: ScreenshotOptions): Promise; select(selector: string, ...values: string[]): Promise; setContent(html: string): Promise; - setCookie(...cookies: Cookie[]): Promise; + setCookie(...cookies: SetCookie[]): Promise; setExtraHTTPHeaders(headers: Headers): Promise; setJavaScriptEnabled(enabled: boolean): Promise; setRequestInterceptionEnabled(value: boolean): Promise;