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

Export strict Parser #25

Closed
fregante opened this issue Sep 8, 2022 · 6 comments
Closed

Export strict Parser #25

fregante opened this issue Sep 8, 2022 · 6 comments

Comments

@fregante
Copy link
Contributor

fregante commented Sep 8, 2022

It seems that the Parse interface isn't exported from ./strict:

type Parse<S extends string> = ParseSelectorToTagNames<S> extends infer Tags

so I can't replace import type {ParseSelector} from 'typed-query-selector/parser' with a stricter version in:

https://github.com/refined-github/refined-github/blob/65c58aed2ceb98e50c9112e7ef0428821033742e/source/helpers/types.d.ts#L2

@g-plane
Copy link
Owner

g-plane commented Sep 9, 2022

Do you need the strict parser?

@fregante
Copy link
Contributor Author

fregante commented Sep 9, 2022

Yes, I'd like to try it in Refined GitHub; I have several APIs that make use of typed-query-selector so it would be good to also use it to validate the selectors (if it works as expected. I never used it)

@g-plane g-plane closed this as completed in d145919 Sep 9, 2022
@stof
Copy link

stof commented Sep 14, 2022

Actually, instead of exporting it from the same file than the one patching Element.querySelector(), it should probably be split into a separate strict-parser file, that could allow importing the strict parser type without patching the DOM APIs. Otherwise, it is unsafe for libraries to depend on the strict parser for their own API (as they would have the side-effect of patching globals).

@g-plane
Copy link
Owner

g-plane commented Sep 14, 2022

Oh, you're right. I'll fix it later.

@fregante
Copy link
Contributor Author

Could you release this change?

@g-plane
Copy link
Owner

g-plane commented Sep 27, 2022

Released v2.8.0.

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

No branches or pull requests

3 participants