Skip to content

Commit

Permalink
fix(types): do not use import('electron') (#5572)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Feb 24, 2021
1 parent 8f79b8c commit 5cb914b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions packages/common/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export * from './types/types';
export const chromium: types.BrowserType<types.ChromiumBrowser>;
export const firefox: types.BrowserType<types.FirefoxBrowser>;
export const webkit: types.BrowserType<types.WebKitBrowser>;
export const _electron: types.Electron;
export const _android: types.Android;
6 changes: 3 additions & 3 deletions packages/installation-tests/installation-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function test_typescript_types {
"playwright-webkit"
do
echo "Checking types of ${PKG_NAME}"
echo "import { Page } from '${PKG_NAME}';" > "${PKG_NAME}.ts" && tsc "${PKG_NAME}.ts"
echo "import { Page } from '${PKG_NAME}';" > "${PKG_NAME}.ts" && npx -p [email protected] tsc "${PKG_NAME}.ts"
done;

echo "${FUNCNAME[0]} success"
Expand Down Expand Up @@ -351,7 +351,7 @@ function test_electron_types {
echo "import { Page, electron, ElectronApplication, Electron } from 'playwright-electron';" > "test.ts"

echo "Running tsc"
npx tsc "test.ts"
npx -p [email protected] tsc "test.ts"

echo "${FUNCNAME[0]} success"
}
Expand All @@ -365,7 +365,7 @@ function test_android_types {
echo "import { AndroidDevice, android, AndroidWebView, Page } from 'playwright-android';" > "test.ts"

echo "Running tsc"
npx tsc "test.ts"
npx -p [email protected] tsc "test.ts"

echo "${FUNCNAME[0]} success"
}
Expand Down
8 changes: 4 additions & 4 deletions types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7095,8 +7095,8 @@ export interface ElectronApplication {
* @param pageFunction Function to be evaluated in the worker context.
* @param arg Optional argument to pass to `pageFunction`.
*/
evaluate<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<R>;
evaluate<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<R>;

/**
* Returns the return value of `pageFunction` as a [JSHandle].
Expand All @@ -7117,8 +7117,8 @@ export interface ElectronApplication {
* @param pageFunction Function to be evaluated in the worker context.
* @param arg
*/
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<SmartHandle<R>>;
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<SmartHandle<R>>;
/**
* This event is issued when the application closes.
*/
Expand Down
8 changes: 4 additions & 4 deletions utils/generate_types/overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ export const selectors: Selectors;
export const devices: Devices & DeviceDescriptor[];

export interface ElectronApplication {
evaluate<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<R>;
evaluate<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<R>;
evaluate<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<R>;

evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<typeof import('electron'), Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<typeof import('electron'), void, R>, arg?: any): Promise<SmartHandle<R>>;
evaluateHandle<R, Arg>(pageFunction: PageFunctionOn<any, Arg, R>, arg: Arg): Promise<SmartHandle<R>>;
evaluateHandle<R>(pageFunction: PageFunctionOn<any, void, R>, arg?: any): Promise<SmartHandle<R>>;
}

export type AndroidElementInfo = {
Expand Down

0 comments on commit 5cb914b

Please sign in to comment.