fix(types): restore electron types (#5574)

This commit is contained in:
Joel Einbinder 2021-02-23 20:29:10 -08:00 committed by GitHub
parent 841264c94d
commit 180446d20f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

11
types/types.d.ts vendored
View File

@ -7042,6 +7042,9 @@ type AccessibilityNode = {
export const selectors: Selectors; export const selectors: Selectors;
export const devices: Devices & DeviceDescriptor[]; export const devices: Devices & DeviceDescriptor[];
//@ts-ignore this will be any if electron is not installed
type ElectronType = typeof import('electron');
/** /**
* Electron application representation. You can use * Electron application representation. You can use
* [electron.launch([options])](https://playwright.dev/docs/api/class-electron#electronlaunchoptions) to obtain the * [electron.launch([options])](https://playwright.dev/docs/api/class-electron#electronlaunchoptions) to obtain the
@ -7095,8 +7098,8 @@ export interface ElectronApplication {
* @param pageFunction Function to be evaluated in the worker context. * @param pageFunction Function to be evaluated in the worker context.
* @param arg Optional argument to pass to `pageFunction`. * @param arg Optional argument to pass to `pageFunction`.
*/ */
evaluate<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<R>; evaluate<R, Arg>(pageFunction: PageFunctionOn<ElectronType, Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<R>; evaluate<R>(pageFunction: PageFunctionOn<ElectronType, void, R>, arg?: any): Promise<R>;
/** /**
* Returns the return value of `pageFunction` as a [JSHandle]. * Returns the return value of `pageFunction` as a [JSHandle].
@ -7117,8 +7120,8 @@ export interface ElectronApplication {
* @param pageFunction Function to be evaluated in the worker context. * @param pageFunction Function to be evaluated in the worker context.
* @param arg * @param arg
*/ */
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<SmartHandle<R>>; evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<ElectronType, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<SmartHandle<R>>; evaluateHandle<R>(pageFunction: PageFunctionOn<ElectronType, void, R>, arg?: any): Promise<SmartHandle<R>>;
/** /**
* This event is issued when the application closes. * This event is issued when the application closes.
*/ */

View File

@ -222,12 +222,15 @@ type AccessibilityNode = {
export const selectors: Selectors; export const selectors: Selectors;
export const devices: Devices & DeviceDescriptor[]; export const devices: Devices & DeviceDescriptor[];
export interface ElectronApplication { //@ts-ignore this will be any if electron is not installed
evaluate<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<R>; type ElectronType = typeof import('electron');
evaluate<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<R>;
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<SmartHandle<R>>; export interface ElectronApplication {
evaluateHandle<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<SmartHandle<R>>; evaluate<R, Arg>(pageFunction: PageFunctionOn<ElectronType, Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<ElectronType, void, R>, arg?: any): Promise<R>;
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<ElectronType, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<ElectronType, void, R>, arg?: any): Promise<SmartHandle<R>>;
} }
export type AndroidElementInfo = { export type AndroidElementInfo = {