@@ -19,66 +19,38 @@ import {whitespace} from 'hast-util-whitespace'
1919import { zwitch } from 'zwitch'
2020import { any } from './any.js'
2121
22+ /** @type {(rule: Rule|RulePseudo, element: Element, index: number|null, parent: Parent|null, state: SelectState) => boolean } */
2223const handle = zwitch ( 'name' , {
23- // @ts -expect-error: hush.
2424 unknown : unknownPseudo ,
2525 invalid : invalidPseudo ,
2626 handlers : {
27- // @ts -expect-error: hush.
2827 any : matches ,
29- // @ts -expect-error: hush.
3028 'any-link' : anyLink ,
31- // @ts -expect-error: hush.
3229 blank,
33- // @ts -expect-error: hush.
3430 checked,
35- // @ts -expect-error: hush.
3631 dir,
37- // @ts -expect-error: hush.
3832 disabled,
39- // @ts -expect-error: hush.
4033 empty,
41- // @ts -expect-error: hush.
4234 enabled,
43- // @ts -expect-error: hush.
4435 'first-child' : firstChild ,
45- // @ts -expect-error: hush.
4636 'first-of-type' : firstOfType ,
47- // @ts -expect-error: hush.
4837 has,
49- // @ts -expect-error: hush.
5038 lang,
51- // @ts -expect-error: hush.
5239 'last-child' : lastChild ,
53- // @ts -expect-error: hush.
5440 'last-of-type' : lastOfType ,
55- // @ts -expect-error: hush.
5641 matches,
57- // @ts -expect-error: hush.
5842 not,
59- // @ts -expect-error: hush.
6043 'nth-child' : nthChild ,
61- // @ts -expect-error: hush.
6244 'nth-last-child' : nthLastChild ,
63- // @ts -expect-error: hush.
6445 'nth-of-type' : nthOfType ,
65- // @ts -expect-error: hush.
6646 'nth-last-of-type' : nthLastOfType ,
67- // @ts -expect-error: hush.
6847 'only-child' : onlyChild ,
69- // @ts -expect-error: hush.
7048 'only-of-type' : onlyOfType ,
71- // @ts -expect-error: hush.
7249 optional,
73- // @ts -expect-error: hush.
7450 'read-only' : readOnly ,
75- // @ts -expect-error: hush.
7651 'read-write' : readWrite ,
77- // @ts -expect-error: hush.
7852 required,
79- // @ts -expect-error: hush.
8053 root,
81- // @ts -expect-error: hush.
8254 scope
8355 }
8456} )
@@ -527,10 +499,13 @@ function invalidPseudo() {
527499}
528500
529501/**
530- * @param {RulePseudo } query
502+ * @param {unknown } query
503+ * @returns {never }
531504 */
532505function unknownPseudo ( query ) {
506+ // @ts -expect-error: indexable.
533507 if ( query . name ) {
508+ // @ts -expect-error: indexable.
534509 throw new Error ( 'Unknown pseudo-selector `' + query . name + '`' )
535510 }
536511
0 commit comments