(TS) Type SelectorMatcherOptions is missing timeout
See original GitHub issuecypress-testing-library
version: 3.0.1node
version: 10.13.0yarn
version: 1.13.0
Relevant code or config
cy.queryByText("foo", { timeout: 100 })
What you did:
Tried to change the value of the timeout option on queryByText
.
What happened:
The test correctly waited for the set amount of time (100ms) but TS validation reports an error:
Problem description:
Queries using the SelectorMatcherOptions
type are missing the type definition for the timeout option.
Suggested solution:
If this is not intentional, take the same approach as for MatcherOptions
in #28 – update typings/index.d.ts
.
How it is now:
import {
SelectorMatcherOptions,
Matcher,
MatcherOptions as DTLMatcherOptions,
getByTestId,
} from 'dom-testing-library'
export interface CTLMatcherOptions {
timeout?: number
}
export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions
How it could be:
import {
SelectorMatcherOptions as DTLSelectorMatcherOptions,
Matcher,
MatcherOptions as DTLMatcherOptions,
getByTestId,
} from 'dom-testing-library'
export interface CTLMatcherOptions {
timeout?: number
}
export type MatcherOptions = DTLMatcherOptions | CTLMatcherOptions
export type SelectorMatcherOptions = DTLSelectorMatcherOptions | CTLMatcherOptions
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
No overload matches this call. Type 'string' is not assignable to ...
When I do ts-node src/main.ts The following error throws and exits. /home/meraj/.nvm/versions/node/v8.10 ...
Read more >Timeout | typescript - v3.7.7
Methods. [Symbol.toPrimitive]. [Symbol.toPrimitive](): number. Overrides Timer.[Symbol.toPrimitive]. Defined in node_modules/@types/node/globals.d.ts:551 ...
Read more >@types/react-timeout - npm
Start using @types/react-timeout in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >Index Signatures in TypeScript - Dmitri Pavlutin
The idea of the index signatures is to type objects of unknown ... Options interface also has a field timeout , which works...
Read more >When to use `never` and `unknown` in TypeScript
never as the parameter of the return type in ; timeout things would not have worked out so cleanly. If we had used...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I could try. It would be my very first PR though. I’ll try to follow your course on egghead and contributing guide and see how far can I make it 🙂.
Thanks to both of you for this!