It is impossible to create a styled button having a component prop with TypeScript #35966
Closed
2 tasks done
Labels
customization: css
Design CSS customizability
support: Stack Overflow
Please ask the community on Stack Overflow
typescript
Duplicates
Latest version
Steps to reproduce 🕹
I have tried creating my basic styled button with a component prop and one custom prop in at least three different ways and none worked with TypeScript. I ended up creating a specialized CtaComponent instead of having one cool generic instead.
Composition
component.tsx
parent.tsx
error:
With
styled()
utilitycomponent.tsx
parent.tsx
error:
Style overrides based on props
No component.tsx. Instead when creating the theme:
parent.tsx
mui.d.ts
error:
Your environment 🌎
``` System: OS: Windows 10 10.0.19045 Binaries: Node: 16.14.0 - C:\Program Files (x86)\nodejs\node.EXE Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.3.1 - C:\Program Files (x86)\nodejs\npm.CMD Browsers: Chrome: 109.0.5414.120 Edge: Spartan (44.19041.1266.0), Chromium (108.0.1462.76) npmPackages: @emotion/react: ^11.10.5 => 11.10.5 @emotion/styled: ^11.10.5 => 11.10.5 @mui/base: 5.0.0-alpha.114 @mui/core-downloads-tracker: 5.11.5 @mui/icons-material: ^5.11.0 => 5.11.0 @mui/material: ^5.11.1 => 5.11.5 @mui/private-theming: 5.11.2 @mui/styled-engine: 5.11.0 @mui/system: 5.11.5 @mui/types: 7.2.3 @mui/utils: 5.11.2 @types/react: ^18.0.26 => 18.0.27 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ~4.9.4 => 4.9.4 ```npx @mui/envinfo
The text was updated successfully, but these errors were encountered: