docs(page): add TypeScript $eval type-hint notes (#6693)

This commit is contained in:
Ross Wollman 2021-06-01 13:50:31 -07:00 committed by GitHub
parent 0f7a7604bc
commit c8c849e164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -1012,6 +1012,8 @@ Examples:
const searchValue = await page.$eval('#search', el => el.value);
const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
// In TypeScript, this example requires an explicit type annotation (HTMLLinkElement) on el:
const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
```
```java

2
types/types.d.ts vendored
View File

@ -200,6 +200,8 @@ export interface Page {
* const searchValue = await page.$eval('#search', el => el.value);
* const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
* const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
* // In TypeScript, this example requires an explicit type annotation (HTMLLinkElement) on el:
* const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
* ```
*
* Shortcut for main frame's