Skip to content

refactor: Prepare types for React 19#2003

Open
tassoevan wants to merge 10 commits into
mainfrom
refactor/prepare-for-react-19-types
Open

refactor: Prepare types for React 19#2003
tassoevan wants to merge 10 commits into
mainfrom
refactor/prepare-for-react-19-types

Conversation

@tassoevan
Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

This pull request focuses on improving type safety and consistency across several packages by refining React type usage, particularly around ReactNode, ReactElement, and forward refs. It also includes minor internal refactoring for clarity and correctness in React hook implementations.

Type Safety and API Consistency Improvements:

  • Updated various component props and exported types to use ReactNode or ReactElement<any> instead of the less specific ReactElement, improving compatibility with React 18+ and supporting a wider range of valid children and icon types. This affects components such as AutoComplete, Callout, IconButton, Menu, MessageGenericPreviewContent, MessageMetricsFollowing, MessageToolbarItem, Sidebar, SidebarTopBar, and related types in fuselage.api.md. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

React Forward Ref and HOC Improvements:

  • Refactored higher-order components in withLabelHelpers.tsx to accept ComponentType instead of ForwardRefExoticComponent, making them more flexible and compatible with a broader range of components. [1] [2] [3] [4] [5]

React Hook and Refactoring Enhancements:

  • Standardized the initialization of refs in custom hooks (useDebouncedCallback, useElementIsVisible, usePrevious) to explicitly use undefined as the initial value, improving type safety and clarity. [1] [2] [3]
  • Renamed isMutableRefObject to isRefObject in useMergedRefs.ts for clearer intent and updated its usage. [1] [2]

ToastBar Component and API Cleanup:

  • Removed unnecessary ReactElement type annotations from ToastBar-related components and updated the API documentation to use JSX.Element or omit explicit return types, aligning with modern React best practices. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Issue(s)

Further comments

tassoevan added 10 commits June 5, 2026 21:11
…ions in functional components

- Removed ReactElement type annotations from multiple functional components across the onboarding-ui package.
- Updated components to use implicit return types for better readability and consistency.
…cific HTML element types for better type safety
@tassoevan tassoevan requested a review from a team June 6, 2026 02:53
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 6, 2026

⚠️ No Changeset found

Latest commit: 21ca2c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

1 participant