From 88439f913ed4159cdc8be573f2dbda0b1f615301 Mon Sep 17 00:00:00 2001
From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
Date: Tue, 18 Jul 2023 18:28:03 +0200
Subject: [PATCH] fix: update the target to ES2022 (#10574)
---
docs/api/puppeteer.jshandle.md | 6 +++---
packages/puppeteer-core/src/api/JSHandle.ts | 4 +---
packages/puppeteer-core/src/common/Frame.ts | 4 +---
packages/puppeteer-core/src/common/JSHandle.ts | 7 -------
packages/puppeteer-core/src/common/WaitTask.ts | 1 -
tsconfig.base.json | 2 +-
6 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/docs/api/puppeteer.jshandle.md b/docs/api/puppeteer.jshandle.md
index 896ec219e4e..f5c50954d9c 100644
--- a/docs/api/puppeteer.jshandle.md
+++ b/docs/api/puppeteer.jshandle.md
@@ -28,9 +28,9 @@ const windowHandle = await page.evaluateHandle(() => window);
## Properties
-| Property | Modifiers | Type | Description |
-| ---------------------- | --------------------- | ---- | -------------------------------------------------------------- |
-| \[\_\_JSHandleSymbol\] | optional
| T | Used for nominally typing [JSHandle](./puppeteer.jshandle.md). |
+| Property | Modifiers | Type | Description |
+| -------- | --------------------- | ---- | -------------------------------------------------------------- |
+| \_ | optional
| T | Used for nominally typing [JSHandle](./puppeteer.jshandle.md). |
## Methods
diff --git a/packages/puppeteer-core/src/api/JSHandle.ts b/packages/puppeteer-core/src/api/JSHandle.ts
index f0f69fb4980..20d53c6aae9 100644
--- a/packages/puppeteer-core/src/api/JSHandle.ts
+++ b/packages/puppeteer-core/src/api/JSHandle.ts
@@ -22,8 +22,6 @@ import {EvaluateFuncWith, HandleFor, HandleOr} from '../common/types.js';
import {ElementHandle} from './ElementHandle.js';
-declare const __JSHandleSymbol: unique symbol;
-
/**
* Represents a reference to a JavaScript object. Instances can be created using
* {@link Page.evaluateHandle}.
@@ -49,7 +47,7 @@ export class JSHandle {
/**
* Used for nominally typing {@link JSHandle}.
*/
- [__JSHandleSymbol]?: T;
+ declare _?: T;
/**
* @internal
diff --git a/packages/puppeteer-core/src/common/Frame.ts b/packages/puppeteer-core/src/common/Frame.ts
index 0d22302994a..43c315a3396 100644
--- a/packages/puppeteer-core/src/common/Frame.ts
+++ b/packages/puppeteer-core/src/common/Frame.ts
@@ -31,7 +31,7 @@ import {
} from './DeviceRequestPrompt.js';
import {ExecutionContext} from './ExecutionContext.js';
import {FrameManager} from './FrameManager.js';
-import {IsolatedWorld, IsolatedWorldChart} from './IsolatedWorld.js';
+import {IsolatedWorld} from './IsolatedWorld.js';
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
import {LazyArg} from './LazyArg.js';
import {LifecycleWatcher, PuppeteerLifeCycleEvent} from './LifecycleWatcher.js';
@@ -46,11 +46,9 @@ export class Frame extends BaseFrame {
#detached = false;
#client!: CDPSession;
- override worlds!: IsolatedWorldChart;
_frameManager: FrameManager;
override _id: string;
_loaderId = '';
- override _name?: string;
override _hasStartedLoading = false;
_lifecycleEvents = new Set();
override _parentId?: string;
diff --git a/packages/puppeteer-core/src/common/JSHandle.ts b/packages/puppeteer-core/src/common/JSHandle.ts
index c138e4ad5b2..a4a9e588d32 100644
--- a/packages/puppeteer-core/src/common/JSHandle.ts
+++ b/packages/puppeteer-core/src/common/JSHandle.ts
@@ -30,17 +30,10 @@ import {
withSourcePuppeteerURLIfNone,
} from './util.js';
-declare const __JSHandleSymbol: unique symbol;
-
/**
* @internal
*/
export class CDPJSHandle extends JSHandle {
- /**
- * Used for nominally typing {@link JSHandle}.
- */
- [__JSHandleSymbol]?: T;
-
#disposed = false;
#context: ExecutionContext;
#remoteObject: Protocol.Runtime.RemoteObject;
diff --git a/packages/puppeteer-core/src/common/WaitTask.ts b/packages/puppeteer-core/src/common/WaitTask.ts
index 9ce1b5780c3..1357c1f88a0 100644
--- a/packages/puppeteer-core/src/common/WaitTask.ts
+++ b/packages/puppeteer-core/src/common/WaitTask.ts
@@ -228,7 +228,6 @@ export class WaitTask {
return error;
}
- // @ts-expect-error TODO: uncomment once cause is supported in Node types.
return new Error('WaitTask failed with an error', {
cause: error,
});
diff --git a/tsconfig.base.json b/tsconfig.base.json
index 01cbdac9d0d..f9c7467458c 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -26,7 +26,7 @@
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
- "target": "ES2021",
+ "target": "ES2022",
"useUnknownInCatchVariables": true,
"skipLibCheck": true
}