chore: upgrade internal types to support TypeScript 4.9.3 (#19280)
Fixes https://github.com/microsoft/TypeScript/issues/51619 Co-authored-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Родитель
48182a4eb2
Коммит
81c8620bfe
|
@ -23,7 +23,7 @@
|
|||
"@babel/preset-react": "^7.18.6",
|
||||
"@types/codemirror": "^5.60.5",
|
||||
"@types/formidable": "^2.0.4",
|
||||
"@types/node": "=14.18.24",
|
||||
"@types/node": "=14.18.34",
|
||||
"@types/react": "^18.0.12",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/resize-observer-browser": "^0.1.7",
|
||||
|
@ -59,7 +59,7 @@
|
|||
"rimraf": "^3.0.2",
|
||||
"socksv5": "0.0.6",
|
||||
"ssim.js": "^3.5.0",
|
||||
"typescript": "^4.7.3",
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^3.2.1",
|
||||
"ws": "^8.5.0",
|
||||
"xml2js": "^0.4.23",
|
||||
|
@ -1083,8 +1083,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.18.24",
|
||||
"license": "MIT"
|
||||
"version": "14.18.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.34.tgz",
|
||||
"integrity": "sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA=="
|
||||
},
|
||||
"node_modules/@types/normalize-package-data": {
|
||||
"version": "2.4.1",
|
||||
|
@ -2348,9 +2349,10 @@
|
|||
"integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA=="
|
||||
},
|
||||
"node_modules/electron/node_modules/@types/node": {
|
||||
"version": "16.11.47",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"version": "16.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.6.tgz",
|
||||
"integrity": "sha512-vmYJF0REqDyyU0gviezF/KHq/fYaUbFhkcNbQCuPGFQj6VTbXuHZoxs/Y7mutWe73C8AC6l9fFu8mSYiBAqkGA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/electron/node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
|
@ -5081,9 +5083,10 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.7.3",
|
||||
"version": "4.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
|
||||
"integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
@ -6778,7 +6781,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.18.24"
|
||||
"version": "14.18.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.34.tgz",
|
||||
"integrity": "sha512-hcU9AIQVHmPnmjRK+XUUYlILlr9pQrsqSrwov/JK1pnf3GTQowVBhx54FbvM0AU/VXGH4i3+vgXS5EguR7fysA=="
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.1",
|
||||
|
@ -7600,7 +7605,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "16.11.47",
|
||||
"version": "16.18.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.6.tgz",
|
||||
"integrity": "sha512-vmYJF0REqDyyU0gviezF/KHq/fYaUbFhkcNbQCuPGFQj6VTbXuHZoxs/Y7mutWe73C8AC6l9fFu8mSYiBAqkGA==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
|
@ -9304,7 +9311,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.7.3",
|
||||
"version": "4.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
|
||||
"integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==",
|
||||
"dev": true
|
||||
},
|
||||
"universalify": {
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
"@babel/preset-react": "^7.18.6",
|
||||
"@types/codemirror": "^5.60.5",
|
||||
"@types/formidable": "^2.0.4",
|
||||
"@types/node": "=14.18.24",
|
||||
"@types/node": "=14.18.34",
|
||||
"@types/react": "^18.0.12",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/resize-observer-browser": "^0.1.7",
|
||||
|
@ -94,7 +94,7 @@
|
|||
"rimraf": "^3.0.2",
|
||||
"socksv5": "0.0.6",
|
||||
"ssim.js": "^3.5.0",
|
||||
"typescript": "^4.7.3",
|
||||
"typescript": "^4.9.3",
|
||||
"vite": "^3.2.1",
|
||||
"ws": "^8.5.0",
|
||||
"xml2js": "^0.4.23",
|
||||
|
|
|
@ -120,6 +120,7 @@ export class FrameExecutionContext extends js.ExecutionContext {
|
|||
}
|
||||
|
||||
export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
|
||||
__elementhandle: T = true as any;
|
||||
declare readonly _context: FrameExecutionContext;
|
||||
readonly _page: Page;
|
||||
declare readonly _objectId: string;
|
||||
|
|
|
@ -27,10 +27,16 @@ export type RemoteObject = {
|
|||
value?: any
|
||||
};
|
||||
|
||||
type NoHandles<Arg> = Arg extends JSHandle ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles<Arg[Key]> } : Arg);
|
||||
interface TaggedAsJSHandle<T> {
|
||||
__jshandle: T;
|
||||
}
|
||||
interface TaggedAsElementHandle<T> {
|
||||
__elementhandle: T;
|
||||
}
|
||||
type NoHandles<Arg> = Arg extends TaggedAsJSHandle<any> ? never : (Arg extends object ? { [Key in keyof Arg]: NoHandles<Arg[Key]> } : Arg);
|
||||
type Unboxed<Arg> =
|
||||
Arg extends dom.ElementHandle<infer T> ? T :
|
||||
Arg extends JSHandle<infer T> ? T :
|
||||
Arg extends TaggedAsElementHandle<infer T> ? T :
|
||||
Arg extends TaggedAsJSHandle<infer T> ? T :
|
||||
Arg extends NoHandles<Arg> ? Arg :
|
||||
Arg extends [infer A0] ? [Unboxed<A0>] :
|
||||
Arg extends [infer A0, infer A1] ? [Unboxed<A0>, Unboxed<A1>] :
|
||||
|
@ -129,6 +135,7 @@ export class ExecutionContext extends SdkObject {
|
|||
}
|
||||
|
||||
export class JSHandle<T = any> extends SdkObject {
|
||||
__jshandle: T = true as any;
|
||||
readonly _context: ExecutionContext;
|
||||
_disposed = false;
|
||||
readonly _objectId: ObjectId | undefined;
|
||||
|
|
|
@ -29,7 +29,7 @@ export async function queryObjectCount(type: Function): Promise<number> {
|
|||
prototypeObjectId: constructorFunction.objectId
|
||||
}, (_, result) => f(result))) as any;
|
||||
|
||||
const { result: { value } } = await new Promise(f => session.post('Runtime.callFunctionOn', {
|
||||
const { result: { value } } = await new Promise<any>(f => session.post('Runtime.callFunctionOn', {
|
||||
functionDeclaration: 'function (arr) { return this.length; }',
|
||||
objectId: instanceArray.objectId,
|
||||
arguments: [{ objectId: instanceArray.objectId }],
|
||||
|
|
|
@ -657,8 +657,7 @@ async function captureLastKeydown(page) {
|
|||
lastEvent.key = e.key;
|
||||
lastEvent.code = e.code;
|
||||
lastEvent.metaKey = e.metaKey;
|
||||
// keyIdentifier only exists in WebKit, and isn't in TypeScript's lib.
|
||||
lastEvent.keyIdentifier = 'keyIdentifier' in e && e['keyIdentifier'];
|
||||
lastEvent.keyIdentifier = 'keyIdentifier' in e && typeof e['keyIdentifier'] === 'string' && e['keyIdentifier'];
|
||||
}, true);
|
||||
return lastEvent;
|
||||
});
|
||||
|
|
|
@ -567,6 +567,23 @@ playwright.chromium.launch().then(async browser => {
|
|||
const value = await handle.jsonValue();
|
||||
const assertion: AssertType<number, typeof value> = true;
|
||||
}
|
||||
{
|
||||
const handle = await page.evaluateHandle(() => document.body);
|
||||
const tuple = { s: '', n: 23, h: handle };
|
||||
const value = await page.evaluate(([{ s, n, h }]) => {
|
||||
return parseInt(s) + n + parseInt(h.nodeName);
|
||||
}, [tuple]);
|
||||
const assertion: AssertType<number, typeof value> = true;
|
||||
}
|
||||
{
|
||||
type T = ({ s: string } | playwright.ElementHandle)[];
|
||||
const handle = await page.evaluateHandle(() => document.body);
|
||||
const tuple: T = [{ s: '' }, handle];
|
||||
const value = await page.evaluate(([a, b]) => {
|
||||
return (a instanceof Node ? a.nodeName : a.s) + (b instanceof Node ? b.nodeName : b.s);
|
||||
}, tuple);
|
||||
const assertion: AssertType<string, typeof value> = true;
|
||||
}
|
||||
|
||||
{
|
||||
const handle = await page.evaluateHandle(() => document.createElement('body'));
|
||||
|
@ -861,3 +878,4 @@ import {
|
|||
Geolocation,
|
||||
HTTPCredentials,
|
||||
} from 'playwright';
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче