Skip to content

Commit 0514417

Browse files
Copilotfregante
andcommitted
Add typed-query-selector/strict for compile-time selector validation
Co-authored-by: fregante <1402241+fregante@users.noreply.github.com>
1 parent 5b2ee04 commit 0514417

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

global.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
/* eslint-disable @typescript-eslint/consistent-type-definitions -- Module augmentation */
22

3+
// Enable strict mode for querySelector to ensure selectors are valid
4+
// eslint-disable-next-line import-x/no-unassigned-import, import-x/no-empty-named-blocks
5+
import type {} from 'typed-query-selector/strict';
6+
37
// Broaden types because testing against `"undefined"` is fine for our regexes
4-
interface RegExp {
5-
test(s: string | undefined): boolean;
8+
declare global {
9+
interface RegExp {
10+
test(s: string | undefined): boolean;
11+
}
612
}
13+
14+
export {};

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"strip-indent": "^4.1.1",
5555
"svelte": "^5.46.1",
5656
"svelte-check": "^4.3.5",
57+
"typed-query-selector": "^2.12.0",
5758
"typescript": "5.9.3",
5859
"vite": "^7.3.1",
5960
"vitest": "^4.0.17",

0 commit comments

Comments
 (0)