forked from fregante/select-dom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test-d.ts
37 lines (30 loc) · 1.04 KB
/
index.test-d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {expectType} from 'tsd';
import select from './index.js';
// `select-dom` defaults to HTMLElement where possible because it's the most common use case, even if technically this should not be HTMLElement.
/**
* SELECT
*/
expectType<HTMLElement | undefined>(select('.wow'));
expectType<HTMLAnchorElement | undefined>(select('a.wow'));
expectType<HTMLBaseElement | undefined>(select('base'));
expectType<SVGGElement | undefined>(select('g'));
/**
* LAST
*/
expectType<HTMLElement | undefined>(select.last('.wow'));
expectType<HTMLAnchorElement | undefined>(select.last('a.wow'));
expectType<HTMLBaseElement | undefined>(select.last('base'));
expectType<SVGGElement | undefined>(select.last('g'));
/**
* EXISTS
*/
expectType<boolean>(select.exists('.wow'));
expectType<boolean>(select.exists('base'));
expectType<boolean>(select.exists('g'));
/**
* ALL
*/
expectType<HTMLElement[]>(select.all('.wow'));
expectType<HTMLBaseElement[]>(select.all('base'));
expectType<SVGGElement[]>(select.all('g'));
expectType<HTMLAnchorElement[]>(select.all('a.wow'));