From f9b5f75fe2d6b0363c698d49b27749ae7d541058 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 23 Feb 2021 20:10:29 -0800 Subject: [PATCH] cherry-pick(release-1.9): do not use import('electron') (#5572) (#5576) Cherry-pick 5cb914b2feab098074232b6d64e6d5e5993f62d5 Co-authored-by: Dmitry Gozman --- packages/common/index.d.ts | 2 ++ packages/installation-tests/installation-tests.sh | 6 +++--- types/types.d.ts | 8 ++++---- utils/generate_types/overrides.d.ts | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/common/index.d.ts b/packages/common/index.d.ts index c90fa88e79657..edce00e135fa2 100644 --- a/packages/common/index.d.ts +++ b/packages/common/index.d.ts @@ -20,3 +20,5 @@ export * from './types/types'; export const chromium: types.BrowserType; export const firefox: types.BrowserType; export const webkit: types.BrowserType; +export const _electron: types.Electron; +export const _android: types.Android; diff --git a/packages/installation-tests/installation-tests.sh b/packages/installation-tests/installation-tests.sh index 7c599e4262353..8561a78731568 100755 --- a/packages/installation-tests/installation-tests.sh +++ b/packages/installation-tests/installation-tests.sh @@ -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 typescript@3.7.5 tsc "${PKG_NAME}.ts" done; echo "${FUNCNAME[0]} success" @@ -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 typescript@3.7.5 tsc "test.ts" echo "${FUNCNAME[0]} success" } @@ -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 typescript@3.7.5 tsc "test.ts" echo "${FUNCNAME[0]} success" } diff --git a/types/types.d.ts b/types/types.d.ts index b01db70419565..3eaccaf8ef6ee 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -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(pageFunction: PageFunctionOn, arg: Arg): Promise; - evaluate(pageFunction: PageFunctionOn, arg?: any): Promise; + evaluate(pageFunction: PageFunctionOn, arg: Arg): Promise; + evaluate(pageFunction: PageFunctionOn, arg?: any): Promise; /** * Returns the return value of `pageFunction` as a [JSHandle]. @@ -7117,8 +7117,8 @@ export interface ElectronApplication { * @param pageFunction Function to be evaluated in the worker context. * @param arg */ - evaluateHandle(pageFunction: PageFunctionOn, arg: Arg): Promise>; - evaluateHandle(pageFunction: PageFunctionOn, arg?: any): Promise>; + evaluateHandle(pageFunction: PageFunctionOn, arg: Arg): Promise>; + evaluateHandle(pageFunction: PageFunctionOn, arg?: any): Promise>; /** * This event is issued when the application closes. */ diff --git a/utils/generate_types/overrides.d.ts b/utils/generate_types/overrides.d.ts index 0f10b187c1f1a..f5468f14fa469 100644 --- a/utils/generate_types/overrides.d.ts +++ b/utils/generate_types/overrides.d.ts @@ -223,11 +223,11 @@ export const selectors: Selectors; export const devices: Devices & DeviceDescriptor[]; export interface ElectronApplication { - evaluate(pageFunction: PageFunctionOn, arg: Arg): Promise; - evaluate(pageFunction: PageFunctionOn, arg?: any): Promise; + evaluate(pageFunction: PageFunctionOn, arg: Arg): Promise; + evaluate(pageFunction: PageFunctionOn, arg?: any): Promise; - evaluateHandle(pageFunction: PageFunctionOn, arg: Arg): Promise>; - evaluateHandle(pageFunction: PageFunctionOn, arg?: any): Promise>; + evaluateHandle(pageFunction: PageFunctionOn, arg: Arg): Promise>; + evaluateHandle(pageFunction: PageFunctionOn, arg?: any): Promise>; } export type AndroidElementInfo = {