import {ElementHandle} from 'puppeteer'; import {expectNotType, expectType} from 'tsd'; declare const handle: ElementHandle; { { expectType | null>(await handle.$('a')); expectNotType | null>(await handle.$('a')); } { expectType | null>(await handle.$('div')); expectNotType | null>(await handle.$('div')); } { expectType | null>(await handle.$('some-custom')); } } { { expectType>>(await handle.$$('a')); expectNotType>>(await handle.$$('a')); } { expectType>>(await handle.$$('div')); expectNotType>>(await handle.$$('div')); } { expectType>>(await handle.$$('some-custom')); } } { expectType( await handle.$eval( 'a', (element, int) => { expectType(element); expectType(int); }, 1 ) ); expectType( await handle.$eval( 'div', (element, int, str) => { expectType(element); expectType(int); expectType(str); }, 1, '' ) ); expectType( await handle.$eval( 'a', (element, value) => { expectType(element); return value; }, 1 ) ); expectType( await handle.$eval( 'some-element', (element, value) => { expectType(element); return value; }, 1 ) ); expectType( await handle.$eval('a', element => { return element; }) ); expectType(await handle.$eval('a', 'document')); } { expectType( await handle.$$eval( 'a', (elements, int) => { expectType(elements); expectType(int); }, 1 ) ); expectType( await handle.$$eval( 'div', (elements, int, str) => { expectType(elements); expectType(int); expectType(str); }, 1, '' ) ); expectType( await handle.$$eval( 'a', (elements, value) => { expectType(elements); return value; }, 1 ) ); expectType( await handle.$$eval( 'some-element', (elements, value) => { expectType(elements); return value; }, 1 ) ); expectType( await handle.$$eval('a', elements => { return elements; }) ); expectType(await handle.$$eval('a', 'document')); } { { expectType | null>( await handle.waitForSelector('a') ); expectNotType | null>( await handle.waitForSelector('a') ); } { expectType | null>( await handle.waitForSelector('div') ); expectNotType | null>( await handle.waitForSelector('div') ); } { expectType | null>( await handle.waitForSelector('some-custom') ); } }