diff options
author | 2021-01-02 00:16:23 -0600 | |
---|---|---|
committer | 2021-01-02 00:16:23 -0600 | |
commit | 334f38f0f12ce88a73e61478ded54693146f6c04 (patch) | |
tree | a2a12b7816a3d70fb8f0afeaa082da7281f76173 /source/features/view-markdown-source.tsx | |
parent | 23f05c1abff354f49175eecb14f0b08fbe5c22e8 (diff) | |
download | refined-github-334f38f0f12ce88a73e61478ded54693146f6c04.tar.gz refined-github-334f38f0f12ce88a73e61478ded54693146f6c04.tar.zst refined-github-334f38f0f12ce88a73e61478ded54693146f6c04.zip |
Meta: Infer better types in `querySelector` and `select-dom` (#3831)
Diffstat (limited to 'source/features/view-markdown-source.tsx')
-rw-r--r-- | source/features/view-markdown-source.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/features/view-markdown-source.tsx b/source/features/view-markdown-source.tsx index 11b88ad6..b1aaeab4 100644 --- a/source/features/view-markdown-source.tsx +++ b/source/features/view-markdown-source.tsx @@ -17,8 +17,8 @@ const lineActions = onetime(async () => { const randomKnownFile = 'https://github.com/sindresorhus/refined-github/blob/b1229bbaeb8cf071f0711bc2ed1b40dd96cd7a05/.editorconfig'; const html = await browser.runtime.sendMessage({request: randomKnownFile}); const blobToolbar = domify(html).querySelector('.BlobToolbar')!; - select<HTMLAnchorElement>('#js-view-git-blame', blobToolbar)!.href = new GitHubURL(location.href).assign({route: 'blame'}).href; - select<HTMLAnchorElement>('#js-new-issue', blobToolbar)!.href = buildRepoURL('issues/new'); + select('a#js-view-git-blame', blobToolbar)!.href = new GitHubURL(location.href).assign({route: 'blame'}).href; + select('a#js-new-issue', blobToolbar)!.href = buildRepoURL('issues/new'); return blobToolbar; }); @@ -48,8 +48,8 @@ This acts as an auto-discarded cache without globals, timers, etc. It should also work clicks on buttons sooner than the page loads. */ async function showSource(): Promise<void> { - const sourceButton = select<HTMLButtonElement>('.rgh-md-source')!; - const renderedButton = select<HTMLButtonElement>('.rgh-md-rendered')!; + const sourceButton = select('button.rgh-md-source')!; + const renderedButton = select('button.rgh-md-rendered')!; sourceButton.disabled = true; @@ -72,8 +72,8 @@ async function showSource(): Promise<void> { } async function showRendered(): Promise<void> { - const sourceButton = select<HTMLButtonElement>('.rgh-md-source')!; - const renderedButton = select<HTMLButtonElement>('.rgh-md-rendered')!; + const sourceButton = select('button.rgh-md-source')!; + const renderedButton = select('button.rgh-md-rendered')!; renderedButton.disabled = true; |