feat(d.ts): improve axe.d.ts types#4081
Merged
WilcoFiers merged 7 commits intodequelabs:developfrom Jul 19, 2023
Merged
Conversation
Before shadow dom support string[] was the correct type for the returned selectors. From code we can see that SerialDqElement.selector is used to populate this, so the type should also be the same.
RelatedNode should have the same selectors and the same element reference as NodeResult. These are populated in process-aggregate.js.
I think this was unintentionally changed in dequelabs#3966. From check definitions we can see that many of them don't specify the incomplete message, because they don't have incomplete as a possible result.
WilcoFiers
requested changes
Jul 12, 2023
Contributor
WilcoFiers
left a comment
There was a problem hiding this comment.
Thanks for opening this PR. I am really curious what you are using these methods for.
More precise types make it easier to write these function in typescript. With this change, complier knows about this.data, this.async, etc.
Like evaluate and after, matches can also be a string or a function, but this is not currently represented in types.
The rule metadata object expected in this.configure and the one returned by getRules are not the same. From the code we can see that tags and actIds are read from the rule itself and not from the metadata object.
Contributor
Author
|
Thanks, I amended the commits with suggestions (+ prettier formatting).
Mostly for custom rules/checks and capturing additional debug information for nodes in results. I think it makes sense for utils commonly used from checks to be available. |
WilcoFiers
approved these changes
Jul 19, 2023
Contributor
|
✅ Reviewed for security. |
Contributor
|
Thank you again for your contribution @hamax! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve axe.d.ts types based on what we found was missing/incorrect and was needed in our code. I added more details for each change in commit messages (I tried to verify that each change is correct by looking at axe internals). Some of the issues were introduced with a recent update in #3966, which prompted me to look into this more.