import {Matcher, MatcherOptions} from './matches' import {waitForOptions} from './wait-for' export type GetErrorFunction = (c: Element | null, alt: string) => string export interface SelectorMatcherOptions extends MatcherOptions { selector?: string ignore?: boolean | string } export type QueryByAttribute = ( attribute: string, container: HTMLElement, id: Matcher, options?: MatcherOptions, ) => HTMLElement | null export type AllByAttribute = ( attribute: string, container: HTMLElement, id: Matcher, options?: MatcherOptions, ) => HTMLElement[] export const queryByAttribute: QueryByAttribute export const queryAllByAttribute: AllByAttribute export function getElementError(message: string, container: HTMLElement): Error /** * query methods have a common call signature. Only the return type differs. */ export type QueryMethod = ( container: HTMLElement, ...args: Arguments ) => Return export type QueryBy = QueryMethod< Arguments, HTMLElement | null > export type GetAllBy = QueryMethod< Arguments, HTMLElement[] > export type FindAllBy = QueryMethod< [Arguments[0], Arguments[1]?, waitForOptions?], Promise > export type GetBy = QueryMethod export type FindBy = QueryMethod< [Arguments[0], Arguments[1]?, waitForOptions?], Promise > export type BuiltQueryMethods = [ QueryBy, GetAllBy, GetBy, FindAllBy, FindBy, ] export function buildQueries( queryByAll: GetAllBy, getMultipleError: (container: HTMLElement, ...args: Arguments) => string, getMissingError: (container: HTMLElement, ...args: Arguments) => string, ): BuiltQueryMethods