diff --git a/types/__tests__/type-tests.ts b/types/__tests__/type-tests.ts index 7a2fadfc..c6377b12 100644 --- a/types/__tests__/type-tests.ts +++ b/types/__tests__/type-tests.ts @@ -80,6 +80,11 @@ async function testQueryHelpers() { getByAutomationId(element, ['id', 'automationId']) findAllByAutomationId(element, 'id', {}, {timeout: 1000}) findByAutomationId(element, 'id', {}, {timeout: 1000}) + // test optional params too + findAllByAutomationId(element, 'id', {}) + findByAutomationId(element, 'id', {}) + findAllByAutomationId(element, 'id') + findByAutomationId(element, 'id') } async function testByRole() { diff --git a/types/query-helpers.d.ts b/types/query-helpers.d.ts index de50a2d3..26c80f19 100644 --- a/types/query-helpers.d.ts +++ b/types/query-helpers.d.ts @@ -1,5 +1,5 @@ -import { Matcher, MatcherOptions } from './matches' -import { waitForOptions } from './wait-for' +import {Matcher, MatcherOptions} from './matches' +import {waitForOptions} from './wait-for' export interface SelectorMatcherOptions extends MatcherOptions { selector?: string @@ -39,12 +39,12 @@ export type GetAllBy = QueryMethod< HTMLElement[] > export type FindAllBy = QueryMethod< - [Arguments[0], Arguments[1], waitForOptions], + [Arguments[0], Arguments[1]?, waitForOptions?], Promise > export type GetBy = QueryMethod export type FindBy = QueryMethod< - [Arguments[0], Arguments[1], waitForOptions], + [Arguments[0], Arguments[1]?, waitForOptions?], Promise >