Skip to content

Meta: Infer better types in querySelector and select-dom#3831

Merged
fregante merged 31 commits intomasterfrom
select-dom-7
Jan 2, 2021
Merged

Meta: Infer better types in querySelector and select-dom#3831
fregante merged 31 commits intomasterfrom
select-dom-7

Conversation

@fregante
Copy link
Member

Testing out https://github.com/g-plane/typed-query-selector with fregante/select-dom#15, but unfortunately the types currently have some issues.

@fregante fregante added the meta Related to Refined GitHub itself label Dec 19, 2020
@fregante
Copy link
Member Author

@fregante fregante changed the title Meta: Try parsed querySelector types Meta: Infer better types in querySelector and select-dom Dec 29, 2020
export const getPRHeadRepo = (): ReturnType<typeof getRepo> => {
return getRepo(select<HTMLAnchorElement>('.commit-ref.head-ref a')!);
const headLink = select('.commit-ref.head-ref a');
return getRepo(headLink);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XO was complaining about the ! on GHA, but TypeScript wouldn't accept it without. This way it works for both. Don't ask me why

@fregante
Copy link
Member Author

Changes so far have been double-checked and should be correct.

@fregante
Copy link
Member Author

I'll merge this after the next version, so we test out the new changes in element-ready first

@yakov116
Copy link
Member

I'll merge this after the next version, so we test out the new changes in element-ready first

Heads up you turned off the auto release

@fregante
Copy link
Member Author

Yep, I want v21.1.1 😃

@fregante fregante merged commit 334f38f into master Jan 2, 2021
@fregante fregante deleted the select-dom-7 branch January 2, 2021 06:16
@yakov116
Copy link
Member

yakov116 commented Jan 2, 2021

🎉

Very nice work!

function init(): void {
// Use an existing dropdown item to preserve its DOM structure (supports old GHE versions)
const sourceItem = select<HTMLAnchorElement>([
'#filters-select-menu a:nth-last-child(2)', // GHE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was wrongly labeled ⬆️ works ⬇️ does not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was added Here

@fregante
Copy link
Member Author

fregante commented Jan 5, 2021

Very nice work!

Thank @g-plane!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

3 participants