diff --git a/types/index.d.ts b/types/index.d.ts index 6360b9a..1a3cd3c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -35,10 +35,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByPlaceholderText( + findByPlaceholderText( id: Matcher, options?: MatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -49,10 +49,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByPlaceholderText( + findAllByPlaceholderText( id: Matcher, options?: MatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -63,10 +63,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByText( + findByText( id: Matcher, options?: SelectorMatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -77,10 +77,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByText( + findAllByText( id: Matcher, options?: SelectorMatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -91,10 +91,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByLabelText( + findByLabelText( id: Matcher, options?: SelectorMatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -105,10 +105,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByLabelText( + findAllByLabelText( id: Matcher, options?: SelectorMatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -119,7 +119,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByAltText(id: Matcher, options?: MatcherOptions): Chainable + findByAltText( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -130,7 +133,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByAltText(id: Matcher, options?: MatcherOptions): Chainable + findAllByAltText( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -141,7 +147,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByTestId(id: Matcher, options?: MatcherOptions): Chainable + findByTestId( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -152,7 +161,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByTestId(id: Matcher, options?: MatcherOptions): Chainable + findAllByTestId( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -163,7 +175,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByTitle(id: Matcher, options?: MatcherOptions): Chainable + findByTitle( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -174,7 +189,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByTitle(id: Matcher, options?: MatcherOptions): Chainable + findAllByTitle( + id: Matcher, + options?: MatcherOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -185,10 +203,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByDisplayValue( + findByDisplayValue( id: Matcher, options?: MatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -199,10 +217,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByDisplayValue( + findAllByDisplayValue( id: Matcher, options?: MatcherOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -213,7 +231,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findByRole(id: ByRoleMatcher, options?: ByRoleOptions): Chainable + findByRole( + id: ByRoleMatcher, + options?: ByRoleOptions, + ): Chainable> /** * dom-testing-library helpers for Cypress @@ -224,10 +245,10 @@ declare global { * @see https://github.com/testing-library/cypress-testing-library#usage * @see https://github.com/testing-library/dom-testing-library#table-of-contents */ - findAllByRole( + findAllByRole( id: ByRoleMatcher, options?: ByRoleOptions, - ): Chainable + ): Chainable> /** * dom-testing-library helpers for Cypress diff --git a/types/test.ts b/types/test.ts index aed3675..b03749d 100644 --- a/types/test.ts +++ b/types/test.ts @@ -1,6 +1,6 @@ /// import {configure} from '.' - import './add-commands' +import './add-commands' configure({testIdAttribute: 'data-myown-testid'}) @@ -13,6 +13,9 @@ cy.findByTestId('foo') // $ExpectType Chainable> cy.findByTitle('foo') // $ExpectType Chainable> cy.findByDisplayValue('foo') // $ExpectType Chainable> cy.findByRole('foo') // $ExpectType Chainable> +// with types +cy.findByLabelText('foo') // $ExpectType Chainable> +cy.findByRole('link') // $ExpectType Chainable> // findAllBy* cy.findAllByPlaceholderText('foo') // $ExpectType Chainable> @@ -23,6 +26,9 @@ cy.findAllByTestId('foo') // $ExpectType Chainable> cy.findAllByTitle('foo') // $ExpectType Chainable> cy.findAllByDisplayValue('foo') // $ExpectType Chainable> cy.findAllByRole('foo') // $ExpectType Chainable> +// with types +cy.findAllByLabelText('foo') // $ExpectType Chainable> +cy.findAllByRole('link') // $ExpectType Chainable> // configure cy.configureCypressTestingLibrary({testIdAttribute: 'data-myawesome-testid'}) // $ExpectType Chainable diff --git a/types/tsconfig.json b/types/tsconfig.json index a782906..8720499 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -1,4 +1,14 @@ { "extends": "../node_modules/kcd-scripts/shared-tsconfig.json", - "include": ["."] + "include": ["."], + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } }