Skip to content

refactor(fuselage-ui-kit): remove unnecessary ReactElement type annotations in components#40809

Merged
tassoevan merged 2 commits into
developfrom
refactor/prepare-types-for-react-19-7
Jun 8, 2026
Merged

refactor(fuselage-ui-kit): remove unnecessary ReactElement type annotations in components#40809
tassoevan merged 2 commits into
developfrom
refactor/prepare-types-for-react-19-7

Conversation

@tassoevan

@tassoevan tassoevan commented Jun 4, 2026

Copy link
Copy Markdown
Member

⚠️ This is part 7/23 of #40796. PR for refactor/prepare-types-for-react-19-6 must be merged first.


Proposed changes (including videos or screenshots)

As a first step towards upgrading to React 19, it handles types from @types/react looking forward the next major.

Issue(s)

Task: ARCH-2170

Steps to test or reproduce

Further comments

No runtime change is expected from it.

Summary by CodeRabbit

  • Refactor
    • Simplified TypeScript typings across the UI kit and surface renderers for cleaner code and better type inference; explicit return-type annotations were removed. No changes to UI behavior or user-facing features.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3350f3c

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

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 899027b0-e829-4d05-86a9-92171d09f16c

📥 Commits

Reviewing files that changed from the base of the PR and between dd45311 and 3350f3c.

📒 Files selected for processing (2)
  • packages/ui-kit/src/blocks/elements/ButtonElement.ts
  • packages/ui-kit/src/blocks/elements/LinearScaleElement.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/ui-kit/src/blocks/elements/ButtonElement.ts
  • packages/ui-kit/src/blocks/elements/LinearScaleElement.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

Walkthrough

This PR systematically removes explicit ReactElement return type annotations from ~40 React components in the fuselage-ui-kit package, relying on TypeScript's inference. It tightens UiKit.SurfaceRenderer generics to ReactElement<any> and switches some renderer methods to ReactNode. TabElement gets a minor click-handler refactor.

Changes

Type Annotation Simplification

Layer / File(s) Summary
Core type infrastructure
packages/fuselage-ui-kit/src/utils/BlockProps.ts, packages/fuselage-ui-kit/src/surfaces/createSurfaceRenderer.tsx, packages/fuselage-ui-kit/src/utils/UiKitComponent.tsx
BlockProps and createSurfaceRenderer now constrain SurfaceRenderer<ReactElement<any>>. UiKitComponent drops explicit ReactElement | null return type and unused import.
Surface renderer type contracts
packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx, packages/fuselage-ui-kit/src/surfaces/ContextualBarSurfaceRenderer.tsx, packages/fuselage-ui-kit/src/surfaces/FuselageMessageSurfaceRenderer.tsx
FuselageSurfaceRenderer methods now use ReactElement<any> | null; tab_navigation and video_conf methods change to ReactNode.
Surface wrapper components
packages/fuselage-ui-kit/src/surfaces/BannerSurface.tsx, packages/fuselage-ui-kit/src/surfaces/ContextualBarSurface.tsx, packages/fuselage-ui-kit/src/surfaces/MessageSurface.tsx, packages/fuselage-ui-kit/src/surfaces/ModalSurface.tsx, packages/fuselage-ui-kit/src/surfaces/Surface.tsx
Surface wrappers remove explicit ReactElement return type annotations and switch prop typing to ReactNode where appropriate; JSX unchanged.
Block components
packages/fuselage-ui-kit/src/blocks/ActionsBlock.Action.tsx, packages/fuselage-ui-kit/src/blocks/ActionsBlock.tsx, packages/fuselage-ui-kit/src/blocks/CalloutBlock.tsx, packages/fuselage-ui-kit/src/blocks/ContextBlock.Item.tsx, packages/fuselage-ui-kit/src/blocks/ContextBlock.tsx, packages/fuselage-ui-kit/src/blocks/DividerBlock.tsx, packages/fuselage-ui-kit/src/blocks/ImageBlock.tsx, packages/fuselage-ui-kit/src/blocks/InfoCard.tsx, packages/fuselage-ui-kit/src/blocks/InputBlock.tsx, packages/fuselage-ui-kit/src/blocks/PreviewBlock.tsx, packages/fuselage-ui-kit/src/blocks/SectionBlock.Fields.tsx, packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx, packages/fuselage-ui-kit/src/blocks/TabNavigationBlock.tsx, packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx
Block components remove explicit ReactElement return types; parser/surfaceRenderer props tightened to SurfaceRenderer<ReactElement<any>>.
Element components
packages/fuselage-ui-kit/src/elements/ButtonElement.tsx, packages/fuselage-ui-kit/src/elements/CheckboxElement.tsx, packages/fuselage-ui-kit/src/elements/DatePickerElement.tsx, packages/fuselage-ui-kit/src/elements/IconButtonElement.tsx, packages/fuselage-ui-kit/src/elements/IconElement.tsx, packages/fuselage-ui-kit/src/elements/ImageElement.tsx, packages/fuselage-ui-kit/src/elements/LinearScaleElement.tsx, packages/fuselage-ui-kit/src/elements/MultiStaticSelectElement.tsx, packages/fuselage-ui-kit/src/elements/OverflowElement.tsx, packages/fuselage-ui-kit/src/elements/PlainTextInputElement.tsx, packages/fuselage-ui-kit/src/elements/RadioButtonElement.tsx, packages/fuselage-ui-kit/src/elements/StaticSelectElement.tsx, packages/fuselage-ui-kit/src/elements/TabElement.tsx, packages/fuselage-ui-kit/src/elements/TimePickerElement.tsx, packages/fuselage-ui-kit/src/elements/ToggleSwitchElement.tsx, packages/fuselage-ui-kit/src/elements/UsersSelectElement/MultiUsersSelectElement.tsx
Element components remove explicit ReactElement return types and simplify React type imports. TabElement click handler simplified to early-return when disabled, then call select and action.
ui-kit type TODOs
packages/ui-kit/src/blocks/elements/ButtonElement.ts, packages/ui-kit/src/blocks/elements/LinearScaleElement.ts
Added inline TODO comments about url validation for ButtonElement and maxValue reasonable limits for LinearScaleElement; no type signature changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

type: chore

Suggested reviewers

  • ggazzo
  • dougfabris
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring effort across the changeset: removing unnecessary ReactElement type annotations from components throughout the fuselage-ui-kit package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (2)
  • REACT-19: Request failed with status code 401
  • ARCH-2170: Request failed with status code 401

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dionisio-bot

dionisio-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.33333% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.03%. Comparing base (67a7d1b) to head (3350f3c).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40809      +/-   ##
===========================================
- Coverage    70.09%   70.03%   -0.06%     
===========================================
  Files         3337     3337              
  Lines       123506   123509       +3     
  Branches     22046    22020      -26     
===========================================
- Hits         86568    86497      -71     
- Misses       33602    33656      +54     
- Partials      3336     3356      +20     
Flag Coverage Δ
e2e 59.37% <ø> (-0.07%) ⬇️
e2e-api 46.24% <ø> (-0.88%) ⬇️
unit 70.81% <58.33%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ations in components

- Updated multiple components to remove explicit return type annotations of ReactElement, allowing TypeScript to infer the return type.
- Adjusted BlockProps to use ReactElement<any> for better type compatibility.
- Cleaned up imports by removing unused ReactElement imports across various files.
@tassoevan tassoevan force-pushed the refactor/prepare-types-for-react-19-7 branch from 583408b to dd45311 Compare June 8, 2026 15:00
@tassoevan tassoevan requested a review from a team June 8, 2026 15:06
@tassoevan tassoevan added this to the 8.6.0 milestone Jun 8, 2026
@tassoevan tassoevan marked this pull request as ready for review June 8, 2026 15:06
ggazzo
ggazzo previously approved these changes Jun 8, 2026
@ggazzo ggazzo added stat: QA assured Means it has been tested and approved by a company insider and removed type: chore labels Jun 8, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 8, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 41 files

Re-trigger cubic

@hacktron-app hacktron-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 2 files

Severity Count
HIGH 1
MEDIUM 1

View full scan results

Comment thread packages/fuselage-ui-kit/src/elements/ButtonElement.tsx
Comment thread packages/fuselage-ui-kit/src/elements/LinearScaleElement.tsx
@tassoevan tassoevan added this pull request to the merge queue Jun 8, 2026
@tassoevan tassoevan removed this pull request from the merge queue due to a manual request Jun 8, 2026
@tassoevan tassoevan enabled auto-merge June 8, 2026 17:21
@tassoevan tassoevan added this pull request to the merge queue Jun 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 8, 2026
@tassoevan tassoevan added this pull request to the merge queue Jun 8, 2026
Merged via the queue into develop with commit 9aeae84 Jun 8, 2026
48 checks passed
@tassoevan tassoevan deleted the refactor/prepare-types-for-react-19-7 branch June 8, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants