Skip to content
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

createBox and Box from @mui/system return different types. #29978

Closed
2 tasks done
Nicktho opened this issue Nov 30, 2021 · 2 comments · Fixed by #29989
Closed
2 tasks done

createBox and Box from @mui/system return different types. #29978

Nicktho opened this issue Nov 30, 2021 · 2 comments · Fixed by #29989
Labels
bug 🐛 Something doesn't work package: system Specific to @mui/system

Comments

@Nicktho
Copy link

Nicktho commented Nov 30, 2021

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When importing from @mui/system,

createBox has the type signature (...) => React.ElementType<any>
where as Box is OverridableComponent<BoxTypeMap<{}, "div">>.

Expected behavior 🤔

createBox should return a type similar to that of the Box

Steps to reproduce 🕹

See the codesandbox: https://codesandbox.io/s/naughty-booth-pxels?file=/src/Demo.tsx

Context 🔦

The main reason to have similar typing between createBox and Box is to take advantage of the SxProps typing that Box has on its sx prop, where as a Box returned from createBox does not have this prop typed.

Your environment 🌎

See codesandbox.

@Nicktho Nicktho added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 30, 2021
@mnajdova
Copy link
Member

mnajdova commented Dec 1, 2021

Thanks for the report, PR coming up right away

@mnajdova mnajdova added bug 🐛 Something doesn't work package: system Specific to @mui/system and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 1, 2021
@Nicktho
Copy link
Author

Nicktho commented Dec 1, 2021

@mnajdova Awesome!

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: system Specific to @mui/system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants