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.

Typing of `act` broken

See original GitHub issue

Describe the bug

The act function exported by @testing-library/react-native is always of type (callback: () => void) => void. However, the underlying function coming from react-test-renderer also has overloads for promises which are incorrectly suppressed.

This error in typing leads to linter errors when one tries to pass promise-returning callbacks to act or tries to await a promise-returning act.

Expected behavior

The act function should have the same typing as the underlying function from react-test-renderer.

Steps to Reproduce

The following snippet will produce linter errors such as this one, depending on one’s linter configuration.

import { act } from '@testing-library/react-native'

await act(async () => {
  await Promise.resolve();
});

Versions

@testing-library/react-native: ^11.3.0 => 11.3.0 
react: 18.0.0 => 18.0.0 
react-native: 0.69.6 => 0.69.6 
react-test-renderer: ^18.2.0 => 18.2.0

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AugustinLFcommented, Nov 3, 2022

OK, I can open a PR but it seems I don’t have permissions to create a branch.

You’ll need to fork the repo and create a branch there. You’ll then be able to create a PR back to this repo from yours.

Please modify both the TS and flow types 😃

0reactions
AugustinLFcommented, Dec 8, 2022

I’m struggling with time right now, got a lot going on at work, so won’t be able to do that right now 😞 (and I’m not personally impacted because we use the types of RTL’s act).

Read more comments on GitHub >

github_iconTop Results From Across the Web

ACT Test Accommodations and English Learner Supports
Allowable ACT Accommodations and English Learner (EL) Supports (PDF), Provides a breakdown of accommodations available and the test type in which they are ......
Read more >
How to Fix a Broken Keyboard | Digital Trends
How to fix a broken keyboard · Right-click on the Start button and select Device Manager on the Power User menu. · Expand...
Read more >
ACT Sections: What's on the ACT? - The Princeton Review
The ACT sections include English, Reading, Math and Science. Get a breakdown of each section including what's tested, number of questions, and time...
Read more >
The ACT Test: Format, Timing & Question Types - StudyPoint
General information about the ACT and its format. Learn about the questions types and how the test is structured. Access a Free ACT...
Read more >
iPhone randomly typing scrolling and opening apps - YouTube
This is a common problem that can be fixed and it covers all iPhone models. The most common issues I hear people say...
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