dequelabs / dequelabs/axe-core
Have a dynamic return type on axe.run, in axe.d.ts
- Dominant language
- JavaScript
- Stars
- 7.5k
- Forks
- 933
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 29
Description
Axe.run's return type depends on what reporter is configured. We should consider providing an optional return type using generics. Here's the gist of it:
```ts
interface DefaultReporterResult {
violations: { id: string }[]
passes: { id: string }[]
foo: 'bar'
etc: true
}
function defaultReporter (results: axe.AxeResults) : DefaultReporterResult {
// ...
}
function run () : Promise {
// ...
return reporter(results) as T
}
```
Contributor guide
Research direction
Start by reading axe.d.ts and the declaration for axe.run, then trace how the configured reporter is represented in the public API. The work is done when the declarations express an optional generic return type that matches custom reporter results while preserving the default result type; the issue provides no test file or existing implementation path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- accessibility, api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100