refactor: Prepare types for React 19#2003
Open
tassoevan wants to merge 10 commits into
Open
Conversation
…ReactNode for consistency
…Element to JSX.Element for consistency
…JSX.Element for consistency
…d TaggedRocketChatLogo components
…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.
…ents for consistency
…cific HTML element types for better type safety
…onentType for improved type consistency
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
ReactNodeorReactElement<any>instead of the less specificReactElement, improving compatibility with React 18+ and supporting a wider range of valid children and icon types. This affects components such asAutoComplete,Callout,IconButton,Menu,MessageGenericPreviewContent,MessageMetricsFollowing,MessageToolbarItem,Sidebar,SidebarTopBar, and related types infuselage.api.md. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]React Forward Ref and HOC Improvements:
withLabelHelpers.tsxto acceptComponentTypeinstead ofForwardRefExoticComponent, making them more flexible and compatible with a broader range of components. [1] [2] [3] [4] [5]React Hook and Refactoring Enhancements:
useDebouncedCallback,useElementIsVisible,usePrevious) to explicitly useundefinedas the initial value, improving type safety and clarity. [1] [2] [3]isMutableRefObjecttoisRefObjectinuseMergedRefs.tsfor clearer intent and updated its usage. [1] [2]ToastBar Component and API Cleanup:
ReactElementtype annotations from ToastBar-related components and updated the API documentation to useJSX.Elementor omit explicit return types, aligning with modern React best practices. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Issue(s)
Further comments