We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@testing-library/react
import { act } from '@testing-library/react'; act(() => {});
Act is marked as deprecated.
The signature (callback: () => VoidOrUndefinedOnly): void of act is deprecated.
Updated react to 18.3 in an existing project
act imported from testing library is marked deprecated.
https://stackblitz.com/edit/rtl-template-749zgo?file=src%2FApp.test.tsx
The js code correctly exports the new React.act which is not deprecated.
React.act
react-testing-library/src/act-compat.js
Line 5 in f6a1677
react-testing-library/types/index.d.ts
Line 10 in f6a1677
Add another condition to the type definition to export React.act when it is present.
export const act: typeof reactAct extends undefined ? (typeof reactDomTestUtilsAct extends undefined ? (callback: () => void) => void : typeof reactDomTestUtilsAct) : typeof reactAct
I think we can also remove the case for act not being present since react peerDependency is ^18.
export const act: typeof reactAct extends undefined ? typeof reactDomTestUtilsAct : typeof reactAct
The text was updated successfully, but these errors were encountered:
Thanks @ambarvm, I've created #1319 to resolve this :)
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
@testing-library/react
version: 15.0.5Relevant code or config:
Act is marked as deprecated.
What you did:
Updated react to 18.3 in an existing project
What happened:
act imported from testing library is marked deprecated.
Reproduction:
https://stackblitz.com/edit/rtl-template-749zgo?file=src%2FApp.test.tsx
Problem description:
The js code correctly exports the new
React.act
which is not deprecated.react-testing-library/src/act-compat.js
Line 5 in f6a1677
But the types file always exports the type of deprecated act.
react-testing-library/types/index.d.ts
Line 10 in f6a1677
Suggested solution:
Add another condition to the type definition to export React.act when it is present.
I think we can also remove the case for act not being present since react peerDependency is ^18.
The text was updated successfully, but these errors were encountered: