Skip to content
New issue

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

feat: React 19, types, and bumped testing library things #2621

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

imjordanxd
Copy link

@imjordanxd imjordanxd commented Feb 7, 2025

Description

This PR bumps react, react-dom, and react-test-renderer to 18.3.1. It also bumps the @testing-library/* packages to the latest versions. All changes are either comments, types, internal variables, or test file updates.

The types are a bit cooked at the moment - not sure how to address this or how it happened. The types are even broken on master.

Type of change

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before): ensuredForwardRef's render function has a new type,ForwardRefRenderFunction, which may cause breaking changes in consumers.

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas - N/A
  • Add documentation - N/A
  • Add hook's story at Storybook - N/A
  • Cover changes with tests - N/A
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage - N/A
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

@imjordanxd imjordanxd changed the title React 18, types, and bumped testing library things feat: React 18, types, and bumped testing library things Feb 7, 2025
@imjordanxd imjordanxd changed the title feat: React 18, types, and bumped testing library things feat: React 19, types, and bumped testing library things Feb 7, 2025
@MiroslavPetrik
Copy link

You will need to do more changes with the ref typings. See #2612 (comment)

@imjordanxd
Copy link
Author

@MiroslavPetrik if we can get a smaller PR that only changes the types, I'd definitely rather go for that! This repo has very little activity these days :/

@@ -9,7 +9,7 @@ export default function usePreviousDistinct<T>(
value: T,
compare: Predicate<T> = strictEquals
): T | undefined {
const prevRef = useRef<T>();
const prevRef = useRef<T | undefined>(undefined);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useRef has 1 required parameter now, but there are still the helper overloads for undefined or null, so you don't need to set those explicitly.

Suggested change
const prevRef = useRef<T | undefined>(undefined);
const prevRef = useRef<T>(undefined);

See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/8c2f6c1e8c0cdea479233ca90b6f50e3cb545fc0/types/react/index.d.ts#L1746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants