Skip to content

Commit 72790dc

Browse files
Copilotfregante
andcommitted
Simplify $ helper implementation and improve comments
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
1 parent 085a422 commit 72790dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import reservedNames from 'github-reserved-names/reserved-names.json' with {type: 'json'};
22
import {addTests} from './collector.ts';
33

4-
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Intentionally using typed querySelector
5-
const $: typeof document.querySelector = <E extends Element = Element>(selector: string) => document.querySelector<E>(selector);
4+
// Selector helpers with typed-query-selector validation.
5+
// The generic parameter allows type override when selector inference isn't specific enough (e.g., attribute-only selectors)
6+
const $ = <E extends Element = Element>(selector: string) => document.querySelector<E>(selector);
67
const exists = (selector: string): boolean => Boolean(document.querySelector(selector));
78

89
const combinedTestOnly = ['combinedTestOnly']; // To be used only to skip tests of combined functions, i.e. isPageA() || isPageB()

0 commit comments

Comments
 (0)