Skip to content

fix(d.ts): Add missing types for public axe methods#3966

Merged
WilcoFiers merged 1 commit intodevelopfrom
update-types
Mar 29, 2023
Merged

fix(d.ts): Add missing types for public axe methods#3966
WilcoFiers merged 1 commit intodevelopfrom
update-types

Conversation

@WilcoFiers
Copy link
Copy Markdown
Contributor

Add types for various missing public options and methods:

  • axe.setup()
  • axe.teardown()
  • axe.getReporter()
  • axe.hasReporter()
  • axe.addReporter()
  • axe.configure({ reporter })
  • axe.configure({ rules: { metadata } })
  • axe.configure({ checks: { metadata } })

Closes: #3965

@WilcoFiers WilcoFiers requested a review from a team as a code owner March 28, 2023 11:43
Copy link
Copy Markdown
Member

@stephenmathieson stephenmathieson left a comment

Choose a reason for hiding this comment

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

Maybe we should just write axe in typescript 😬

@WilcoFiers WilcoFiers merged commit 78264ee into develop Mar 29, 2023
@WilcoFiers WilcoFiers deleted the update-types branch March 29, 2023 08:55
hamax added a commit to hamax/axe-core that referenced this pull request Jul 5, 2023
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.
hamax added a commit to hamax/axe-core that referenced this pull request Jul 5, 2023
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 pushed a commit that referenced this pull request Jul 19, 2023
* fix(d.ts): target selector type for shadow dom

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.

* feat(d.ts): add missing properties to the RelatedNode interface

RelatedNode should have the same selectors and the same element
reference as NodeResult. These are populated in process-aggregate.js.

* fix(d.ts): incomplete message should be optional

I think this was unintentionally changed in #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.

* feat(d.ts): add stronger typing to Check evaluate and after functions

More precise types make it easier to write these function in typescript.
With this change, complier knows about this.data, this.async, etc.

* feat(d.ts): allow rule.matches to be a function

Like evaluate and after, matches can also be a string or a function, but
this is not currently represented in types.

* fix(d.ts): tags and actIds should be on Rule and not RuleMetadata

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.

* feat(d.ts): add types for more utils and commons functions
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

Successfully merging this pull request may close these issues.

Axe-core's d.ts file is incomplete

2 participants