question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(TS) Type SelectorMatcherOptions is missing timeout

See original GitHub issue
  • cypress-testing-library version: 3.0.1
  • node version: 10.13.0
  • yarn 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: ctl-type-err

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:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
ShimiTheFirstcommented, May 30, 2019

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 🙂.

2reactions
kentcdoddscommented, Jun 3, 2019

Thanks to both of you for this!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found