diff options
Diffstat (limited to 'source/helpers')
-rw-r--r-- | source/helpers/fetch-dom.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/helpers/fetch-dom.ts b/source/helpers/fetch-dom.ts index 9d901496..9de536ca 100644 --- a/source/helpers/fetch-dom.ts +++ b/source/helpers/fetch-dom.ts @@ -1,8 +1,9 @@ import mem from 'mem'; import domify from 'doma'; +import type {ParseSelector} from 'typed-query-selector/parser'; async function fetchDom(url: string): Promise<DocumentFragment>; -async function fetchDom<TElement extends Element>(url: string, selector: string): Promise<TElement | undefined>; +async function fetchDom<Selector extends string, TElement extends Element = ParseSelector<Selector>>(url: string, selector: Selector): Promise<TElement | undefined>; async function fetchDom(url: string, selector?: string): Promise<Node | undefined> { const absoluteURL = new URL(url, location.origin).toString(); // Firefox `fetch`es from the content script, so relative URLs fail const response = await fetch(absoluteURL); |