Skip to content

Commit

Permalink
fix(d.ts): add optional include to ContextObject (#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Dec 14, 2022
1 parent bb4ad21 commit 36ed242
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ declare namespace axe {
}
| {
exclude: Selector | SelectorList;
include?: Selector | SelectorList;
};
type ElementContext = Selector | SelectorList | ContextObject;

Expand Down
17 changes: 17 additions & 0 deletions typings/axe-core/axe-core-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ export async function runAsync() {
]
});
}

let ctxt: axe.ContextObject;
// @ts-expect-error
ctxt = {};
ctxt = { exclude: ['foo'] };
ctxt.include = ['bard'];
ctxt = { include: ['foo'] };
ctxt.exclude = ['bar'];

let serialContext: axe.SerialContextObject;
// @ts-expect-error
serialContext = {};
serialContext = { exclude: ['foo'] };
serialContext.include = ['bard'];
serialContext = { include: ['foo'] };
serialContext.exclude = ['bar'];

axe.run(
{ exclude: [$fixture[0]] },
{},
Expand Down

0 comments on commit 36ed242

Please sign in to comment.