diff options
author | 2021-04-08 22:10:15 -0400 | |
---|---|---|
committer | 2021-04-08 22:10:15 -0400 | |
commit | 4ff98524e61389fb7628e5816bfcdaac4e0f0cc6 (patch) | |
tree | dacd4f21ea7286723530350d38cfe27bb846a568 /source/helpers/fetch-dom.ts | |
parent | 8eaad7215a10ab2ffc18bcbf3759a83eb01a49aa (diff) | |
download | refined-github-4ff98524e61389fb7628e5816bfcdaac4e0f0cc6.tar.gz refined-github-4ff98524e61389fb7628e5816bfcdaac4e0f0cc6.tar.zst refined-github-4ff98524e61389fb7628e5816bfcdaac4e0f0cc6.zip |
Lint (#4207)
Diffstat (limited to 'source/helpers/fetch-dom.ts')
-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); |