diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 182bd7d14f..623d73962f 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -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 diff --git a/types/types.d.ts b/types/types.d.ts index 1f2759f5af..80078214a0 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -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