Skip to content

[typescript] Fix portable types - #4058

Merged
LukasTy merged 3 commits into
mui:masterfrom
cgatian:3937-portable-types
Feb 13, 2026
Merged

LukasTy merged 3 commits into
mui:masterfrom
cgatian:3937-portable-types

Conversation

@cgatian

@cgatian cgatian commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3937

Continues work done in: #3946 by @mj12albert ❤️


This PR improves the portablity of TypeScript types for consumers building component libraries.

Moves the HTMLProps, ComponentRenderFn, and BaseUIEvent types needed for portablity into /types/index.ts. This export is already marked as exported in the package.json.

Updates src/utils/types to import these types, and re-exports them preventing a mass code refactor.

Testing

  1. I setup a repository reproducing the protablity issue: https://github.com/cgatian/baseui-portable-repro
  2. Running pnpm run build:types on this repo fails.
  3. I then forked Base UI and used pnpm link to these changes

TODO

  • Using the build hash, I will double-check this works in our massive monorepo.
    Works! 🎊

@pkg-pr-new

pkg-pr-new Bot commented Feb 12, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/@base-ui/react@4058
    
    pnpm add https://pkg.pr.new/@base-ui/utils@4058
    

commit: 6026035

@mui-bot

mui-bot commented Feb 12, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@greptile-apps

greptile-apps Bot commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

Moves HTMLProps, ComponentRenderFn, and BaseUIEvent type definitions from utils/types.ts to types/index.ts to improve TypeScript type portability for external component library consumers. The utils/types.ts file now re-exports these types to maintain backward compatibility with existing internal imports.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward type refactoring with proper re-exports to maintain backward compatibility. The React import was correctly added back after being identified as missing in a previous review thread. The types are moved to a public export path that already exists in package.json, improving portability without breaking existing code.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/types/index.ts Adds HTMLProps, ComponentRenderFn, and BaseUIEvent type definitions to make them portable for external consumers
packages/react/src/utils/types.ts Re-exports portable types from ../types and preserves React import for types still used in this file

@greptile-apps greptile-apps 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.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread packages/react/src/utils/types.ts Resolved
@netlify

netlify Bot commented Feb 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 6026035
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/698ddba469eaa00008496d7a
😎 Deploy Preview https://deploy-preview-4058--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cgatian

cgatian commented Feb 12, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai can you review again?

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution. 🙏
This makes sense to me. I suggested a similar path here: #3946 (comment)

@LukasTy LukasTy added the type: bug It doesn't behave as expected. label Feb 13, 2026
@LukasTy
LukasTy merged commit 6b6c87f into mui:master Feb 13, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug It doesn't behave as expected. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[typescript] Type portability for components extended with react-redux

4 participants