import {type 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.$('a#id') ); expectNotType | null>(await handle.$('a#id')); } { expectType | null>( await handle.$('a.class') ); expectNotType | null>(await handle.$('a.class')); } { expectType | null>( await handle.$('a[attr=value]') ); expectNotType | null>( await handle.$('a[attr=value]') ); } { expectType | null>( await handle.$('a:psuedo-class') ); expectNotType | null>( await handle.$('a:pseudo-class') ); } { expectType | null>( await handle.$('a:func(arg)') ); expectNotType | null>( await handle.$('a:func(arg)') ); } } { { expectType | null>(await handle.$('div')); expectNotType | null>(await handle.$('div')); } { expectType | null>( await handle.$('div#id') ); expectNotType | null>(await handle.$('div#id')); } { expectType | null>( await handle.$('div.class') ); expectNotType | null>(await handle.$('div.class')); } { expectType | null>( await handle.$('div[attr=value]') ); expectNotType | null>( await handle.$('div[attr=value]') ); } { expectType | null>( await handle.$('div:psuedo-class') ); expectNotType | null>( await handle.$('div:pseudo-class') ); } { expectType | null>( await handle.$('div:func(arg)') ); expectNotType | null>( await handle.$('div:func(arg)') ); } } { { expectType | null>(await handle.$('some-custom')); } { expectType | null>( await handle.$('some-custom#id') ); } { expectType | null>( await handle.$('some-custom.class') ); } { expectType | null>( await handle.$('some-custom[attr=value]') ); } { expectType | null>( await handle.$('some-custom:pseudo-class') ); } { expectType | null>( await handle.$('some-custom:func(arg)') ); } } { { expectType | null>(await handle.$('')); } { expectType | null>(await handle.$('#id')); } { expectType | null>(await handle.$('.class')); } { expectType | null>(await handle.$('[attr=value]')); } { expectType | null>( await handle.$(':pseudo-class') ); } { expectType | null>(await handle.$(':func(arg)')); } } { { expectType | null>( await handle.$('div > a') ); expectNotType | null>(await handle.$('div > a')); } { expectType | null>( await handle.$('div > a#id') ); expectNotType | null>( await handle.$('div > a#id') ); } { expectType | null>( await handle.$('div > a.class') ); expectNotType | null>( await handle.$('div > a.class') ); } { expectType | null>( await handle.$('div > a[attr=value]') ); expectNotType | null>( await handle.$('div > a[attr=value]') ); } { expectType | null>( await handle.$('div > a:psuedo-class') ); expectNotType | null>( await handle.$('div > a:pseudo-class') ); } { expectType | null>( await handle.$('div > a:func(arg)') ); expectNotType | null>( await handle.$('div > a:func(arg)') ); } } { { expectType | null>( await handle.$('div > div') ); expectNotType | null>(await handle.$('div > div')); } { expectType | null>( await handle.$('div > div#id') ); expectNotType | null>( await handle.$('div > div#id') ); } { expectType | null>( await handle.$('div > div.class') ); expectNotType | null>( await handle.$('div > div.class') ); } { expectType | null>( await handle.$('div > div[attr=value]') ); expectNotType | null>( await handle.$('div > div[attr=value]') ); } { expectType | null>( await handle.$('div > div:psuedo-class') ); expectNotType | null>( await handle.$('div > div:pseudo-class') ); } { expectType | null>( await handle.$('div > div:func(arg)') ); expectNotType | null>( await handle.$('div > div:func(arg)') ); } } { { expectType | null>( await handle.$('div > some-custom') ); } { expectType | null>( await handle.$('div > some-custom#id') ); } { expectType | null>( await handle.$('div > some-custom.class') ); } { expectType | null>( await handle.$('div > some-custom[attr=value]') ); } { expectType | null>( await handle.$('div > some-custom:pseudo-class') ); } { expectType | null>( await handle.$('div > some-custom:func(arg)') ); } } { { expectType | null>(await handle.$('div > #id')); } { expectType | null>(await handle.$('div > .class')); } { expectType | null>( await handle.$('div > [attr=value]') ); } { expectType | null>( await handle.$('div > :pseudo-class') ); } { expectType | null>( await handle.$('div > :func(arg)') ); } } { { expectType | null>( await handle.$('div > a') ); expectNotType | null>(await handle.$('div > a')); } { expectType | null>( await handle.$('div > a#id') ); expectNotType | null>( await handle.$('div > a#id') ); } { expectType | null>( await handle.$('div > a.class') ); expectNotType | null>( await handle.$('div > a.class') ); } { expectType | null>( await handle.$('div > a[attr=value]') ); expectNotType | null>( await handle.$('div > a[attr=value]') ); } { expectType | null>( await handle.$('div > a:psuedo-class') ); expectNotType | null>( await handle.$('div > a:pseudo-class') ); } { expectType | null>( await handle.$('div > a:func(arg)') ); expectNotType | null>( await handle.$('div > a:func(arg)') ); } } { { expectType | null>( await handle.$('div > div') ); expectNotType | null>(await handle.$('div > div')); } { expectType | null>( await handle.$('div > div#id') ); expectNotType | null>( await handle.$('div > div#id') ); } { expectType | null>( await handle.$('div > div.class') ); expectNotType | null>( await handle.$('div > div.class') ); } { expectType | null>( await handle.$('div > div[attr=value]') ); expectNotType | null>( await handle.$('div > div[attr=value]') ); } { expectType | null>( await handle.$('div > div:psuedo-class') ); expectNotType | null>( await handle.$('div > div:pseudo-class') ); } { expectType | null>( await handle.$('div > div:func(arg)') ); expectNotType | null>( await handle.$('div > div:func(arg)') ); } } { { expectType | null>( await handle.$('div > some-custom') ); } { expectType | null>( await handle.$('div > some-custom#id') ); } { expectType | null>( await handle.$('div > some-custom.class') ); } { expectType | null>( await handle.$('div > some-custom[attr=value]') ); } { expectType | null>( await handle.$('div > some-custom:pseudo-class') ); } { expectType | null>( await handle.$('div > some-custom:func(arg)') ); } } { { expectType | null>(await handle.$('div > #id')); } { expectType | null>(await handle.$('div > .class')); } { expectType | null>( await handle.$('div > [attr=value]') ); } { expectType | null>( await handle.$('div > :pseudo-class') ); } { expectType | null>( await handle.$('div > :func(arg)') ); } } } { { { expectType>>(await handle.$$('a')); expectNotType>>(await handle.$$('a')); } { expectType>>( await handle.$$('a#id') ); expectNotType>>(await handle.$$('a#id')); } { expectType>>( await handle.$$('a.class') ); expectNotType>>(await handle.$$('a.class')); } { expectType>>( await handle.$$('a[attr=value]') ); expectNotType>>( await handle.$$('a[attr=value]') ); } { expectType>>( await handle.$$('a:psuedo-class') ); expectNotType>>( await handle.$$('a:pseudo-class') ); } { expectType>>( await handle.$$('a:func(arg)') ); expectNotType>>( await handle.$$('a:func(arg)') ); } } { { expectType>>(await handle.$$('div')); expectNotType>>(await handle.$$('div')); } { expectType>>( await handle.$$('div#id') ); expectNotType>>(await handle.$$('div#id')); } { expectType>>( await handle.$$('div.class') ); expectNotType>>( await handle.$$('div.class') ); } { expectType>>( await handle.$$('div[attr=value]') ); expectNotType>>( await handle.$$('div[attr=value]') ); } { expectType>>( await handle.$$('div:psuedo-class') ); expectNotType>>( await handle.$$('div:pseudo-class') ); } { expectType>>( await handle.$$('div:func(arg)') ); expectNotType>>( await handle.$$('div:func(arg)') ); } } { { expectType>>(await handle.$$('some-custom')); } { expectType>>( await handle.$$('some-custom#id') ); } { expectType>>( await handle.$$('some-custom.class') ); } { expectType>>( await handle.$$('some-custom[attr=value]') ); } { expectType>>( await handle.$$('some-custom:pseudo-class') ); } { expectType>>( await handle.$$('some-custom:func(arg)') ); } } { { expectType>>(await handle.$$('')); } { expectType>>(await handle.$$('#id')); } { expectType>>(await handle.$$('.class')); } { expectType>>( await handle.$$('[attr=value]') ); } { expectType>>( await handle.$$(':pseudo-class') ); } { expectType>>(await handle.$$(':func(arg)')); } } { { expectType>>( await handle.$$('div > a') ); expectNotType>>(await handle.$$('div > a')); } { expectType>>( await handle.$$('div > a#id') ); expectNotType>>( await handle.$$('div > a#id') ); } { expectType>>( await handle.$$('div > a.class') ); expectNotType>>( await handle.$$('div > a.class') ); } { expectType>>( await handle.$$('div > a[attr=value]') ); expectNotType>>( await handle.$$('div > a[attr=value]') ); } { expectType>>( await handle.$$('div > a:psuedo-class') ); expectNotType>>( await handle.$$('div > a:pseudo-class') ); } { expectType>>( await handle.$$('div > a:func(arg)') ); expectNotType>>( await handle.$$('div > a:func(arg)') ); } } { { expectType>>( await handle.$$('div > div') ); expectNotType>>( await handle.$$('div > div') ); } { expectType>>( await handle.$$('div > div#id') ); expectNotType>>( await handle.$$('div > div#id') ); } { expectType>>( await handle.$$('div > div.class') ); expectNotType>>( await handle.$$('div > div.class') ); } { expectType>>( await handle.$$('div > div[attr=value]') ); expectNotType>>( await handle.$$('div > div[attr=value]') ); } { expectType>>( await handle.$$('div > div:psuedo-class') ); expectNotType>>( await handle.$$('div > div:pseudo-class') ); } { expectType>>( await handle.$$('div > div:func(arg)') ); expectNotType>>( await handle.$$('div > div:func(arg)') ); } } { { expectType>>( await handle.$$('div > some-custom') ); } { expectType>>( await handle.$$('div > some-custom#id') ); } { expectType>>( await handle.$$('div > some-custom.class') ); } { expectType>>( await handle.$$('div > some-custom[attr=value]') ); } { expectType>>( await handle.$$('div > some-custom:pseudo-class') ); } { expectType>>( await handle.$$('div > some-custom:func(arg)') ); } } { { expectType>>(await handle.$$('div > #id')); } { expectType>>( await handle.$$('div > .class') ); } { expectType>>( await handle.$$('div > [attr=value]') ); } { expectType>>( await handle.$$('div > :pseudo-class') ); } { expectType>>( await handle.$$('div > :func(arg)') ); } } { { expectType>>( await handle.$$('div > a') ); expectNotType>>(await handle.$$('div > a')); } { expectType>>( await handle.$$('div > a#id') ); expectNotType>>( await handle.$$('div > a#id') ); } { expectType>>( await handle.$$('div > a.class') ); expectNotType>>( await handle.$$('div > a.class') ); } { expectType>>( await handle.$$('div > a[attr=value]') ); expectNotType>>( await handle.$$('div > a[attr=value]') ); } { expectType>>( await handle.$$('div > a:psuedo-class') ); expectNotType>>( await handle.$$('div > a:pseudo-class') ); } { expectType>>( await handle.$$('div > a:func(arg)') ); expectNotType>>( await handle.$$('div > a:func(arg)') ); } } { { expectType>>( await handle.$$('div > div') ); expectNotType>>( await handle.$$('div > div') ); } { expectType>>( await handle.$$('div > div#id') ); expectNotType>>( await handle.$$('div > div#id') ); } { expectType>>( await handle.$$('div > div.class') ); expectNotType>>( await handle.$$('div > div.class') ); } { expectType>>( await handle.$$('div > div[attr=value]') ); expectNotType>>( await handle.$$('div > div[attr=value]') ); } { expectType>>( await handle.$$('div > div:psuedo-class') ); expectNotType>>( await handle.$$('div > div:pseudo-class') ); } { expectType>>( await handle.$$('div > div:func(arg)') ); expectNotType>>( await handle.$$('div > div:func(arg)') ); } } { { expectType>>( await handle.$$('div > some-custom') ); } { expectType>>( await handle.$$('div > some-custom#id') ); } { expectType>>( await handle.$$('div > some-custom.class') ); } { expectType>>( await handle.$$('div > some-custom[attr=value]') ); } { expectType>>( await handle.$$('div > some-custom:pseudo-class') ); } { expectType>>( await handle.$$('div > some-custom:func(arg)') ); } } { { expectType>>(await handle.$$('div > #id')); } { expectType>>( await handle.$$('div > .class') ); } { expectType>>( await handle.$$('div > [attr=value]') ); } { expectType>>( await handle.$$('div > :pseudo-class') ); } { expectType>>( await handle.$$('div > :func(arg)') ); } } } { 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') ); } }