Skip to content

[styled-engine-sc] Fix types for components extended with styled #45988

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

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

Conversation

megos
Copy link
Contributor

@megos megos commented Apr 23, 2025

Closes: #44246

Improve type support for passing a styled component as an argument to styled.

Before: https://stackblitz.com/edit/vitejs-vite-afbuyz?file=src%2FApp.tsx&view=editor
After: https://stackblitz.com/edit/vitejs-vite-tggt1unx

@zannager zannager requested a review from mnajdova April 23, 2025 16:54
@zannager zannager added the package: styled-engine-sc Specific to styled-components label Apr 23, 2025
@mui-bot
Copy link

mui-bot commented May 1, 2025

Netlify deploy preview

https://deploy-preview-45988--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 0ea7b86

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@megos How did you test this? I updated @mui/material to this PR build:

- "@mui/material": "latest",
+ "@mui/material": "https://pkg.pr.new/mui/material-ui/@mui/material@0ea7b86",

in this StackBlitz: https://stackblitz.com/edit/vitejs-vite-tggt1unx — but TypeScript isn’t throwing any error for Button2.

Edit: Oh, I had to replace @mui/styled-engine-sc version to point to this PR build and it works! Ignore above message.

@ZeeshanTamboli
Copy link
Member

@mnajdova Can you review?

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work typescript labels May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work package: styled-engine-sc Specific to styled-components typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[styled-engine-sc] Using extended styles with styled-components breaks types
4 participants