Update test.ts

This commit is contained in:
Max Schmitt 2024-03-18 05:32:24 +01:00 committed by GitHub
parent ea462618d4
commit 675b97fb8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -323,12 +323,19 @@ playwright.chromium.launch().then(async browser => {
console.log(await resultHandle.jsonValue());
await resultHandle.dispose();
// evaluteHandle with two different return types
// evaluteHandle with two different return types (JSHandle)
{
const handle = await page.evaluateHandle(() => '' as string | number);
const result = await handle.evaluate(value => value);
const assertion: AssertType<string | number, typeof result> = true;
}
// evaluteHandle with two different return types (ElementHandle)
{
const handle = await page.evaluateHandle(() => '' as HTMLInputElement | HTMLTextAreaElement);
await handle.evaluate(element => element.value);
const assertion: AssertType<ElementHandle<HTMLInputElement | HTMLTextAreaElement>, typeof handle> = true;
}
await browser.close();
})();