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

Use types directly from querySelector, without copying them #32

Open
fregante opened this issue Dec 29, 2020 · 0 comments
Open

Use types directly from querySelector, without copying them #32

fregante opened this issue Dec 29, 2020 · 0 comments

Comments

@fregante
Copy link
Collaborator

fregante commented Dec 29, 2020

If the selector is 'a', querySelector‘s return type is be HTMLAnchorElement. To achieve the same in element-ready, we had to manually copy its types and adapt them to elementReady

Ideally, instead, we should try to “inherit” directly from the global querySelector so that, if its types are enhanced (via typed-query-selector or natively), element-ready automatically gets upgraded.

Note: We can't use Parameters<typeof querySelector> and such because it doesn't support overloads nor generics.

This has been unsuccessfully tried in #31. More info about it in that PR. A possible solution might be microsoft/TypeScript#33185 (comment)

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

No branches or pull requests

1 participant