Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is .closest supported? #16

Closed
yakov116 opened this issue Apr 26, 2021 · 13 comments
Closed

is .closest supported? #16

yakov116 opened this issue Apr 26, 2021 · 13 comments
Labels
enhancement New feature or request

Comments

@yakov116
Copy link

No description provided.

@g-plane
Copy link
Owner

g-plane commented Apr 27, 2021

Can you provide more details? (For example, MDN documentation link)

@yakov116
Copy link
Author

document.querySelector('a').closest('img') currently we have to do .closest<HTMLImgElement>('img')

@g-plane g-plane added the enhancement New feature or request label Apr 27, 2021
@g-plane
Copy link
Owner

g-plane commented Apr 28, 2021

Sorry for delay! v2.6.0 is released.

@yakov116
Copy link
Author

Awesome!! your so fast!

@yakov116
Copy link
Author

Could the default fallback be HTMLElement?

@g-plane
Copy link
Owner

g-plane commented Apr 28, 2021

I think we should keep align with TypeScript's built-in types.

@yakov116
Copy link
Author

yakov116 commented Apr 28, 2021

ok how would I set that in my project (sorry I don't really know typescript [yet])

thanks

@g-plane
Copy link
Owner

g-plane commented Apr 28, 2021

Are there any use cases or examples?

@yakov116
Copy link
Author

@g-plane
Copy link
Owner

g-plane commented Apr 28, 2021

I may need to investigate usage and try to find a solution.

HTMLElement contains some properties which Element doesn't, so we can't replace it directly.

@fregante
Copy link
Contributor

What do you think about exporting a file that defaults to HTMLElement for both querySelector and closest? So I can use import 'typed-query-selector/html'

@g-plane
Copy link
Owner

g-plane commented Dec 17, 2021

I also thought about that several months ago, but the reason why I didn't do it finally is that there's already 'typed-query-selector/strict', and what about some users want both strict and html? I was looking for an elegant solution to mix them, but it's hard.

@fregante
Copy link
Contributor

That's alright, I ended up copy-pasting shim.d.ts and adjusting it. Thanks a lot for this package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants