diff --git a/axe.d.ts b/axe.d.ts index 1d0ad14fc2..789f35d1a8 100644 --- a/axe.d.ts +++ b/axe.d.ts @@ -12,6 +12,8 @@ declare module axe { type RunOnlyType = "rule" | "rules" | "tag" | "tags"; + type RunCallback = (error: Error, results:AxeResults) => void; + interface ElementContext { node?: Object, selector?: string, @@ -26,6 +28,13 @@ declare module axe { } values?: TagValue[] } + interface RunOptions { + runOnly?: RunOnly, + rules?: Object, + iframes?: Boolean, + elementRef?: Boolean, + selectors?: Boolean + } interface AxeResults { url: string, timestamp: string, @@ -117,12 +126,18 @@ declare module axe { /** * Runs a number of rules against the provided HTML page and returns the resulting issue list * - * @param {Object} context Optional The `Context` specification object @see Context - * @param {Array} options Optional Options passed into rules or checks, temporarily modifying them. - * @param {Function} callback Optional The function to invoke when analysis is complete. - * @returns {any} results If the callback was not defined, aXe will return a Promise instead. + * @param {ElementContext} context Optional The `Context` specification object @see Context + * @param {RunOptions} options Optional Options passed into rules or checks, temporarily modifying them. + * @param {RunCallback} callback Optional The function to invoke when analysis is complete. + * @returns {Promise|void} If the callback was not defined, aXe will return a Promise. */ - function run(context?: ElementContext, options?: {runOnly?: RunOnly, rules?: Object, iframes?: Boolean, elementRef?: Boolean, selectors?: Boolean}, callback?: (error: Error, results:AxeResults) => void): any + function run(context: ElementContext): Promise + function run(options: RunOptions): Promise + function run(callback: (error: Error, results:AxeResults) => void): void + function run(context: ElementContext, callback: RunCallback): void + function run(options: RunOptions, callback: RunCallback): void + function run(context: ElementContext, options: RunOptions): Promise + function run(context: ElementContext, options: RunOptions, callback: RunCallback): void /** * Starts analysis on the current document and its subframes