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

[material-ui][AlertTitle] Missing Typography props when using AlertTitle #42015

Open
d4rekanguok opened this issue Apr 24, 2024 · 3 comments
Open
Labels
bug 🐛 Something doesn't work component: alert This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. package: material-ui Specific to @mui/material typescript

Comments

@d4rekanguok
Copy link

d4rekanguok commented Apr 24, 2024

Steps to reproduce

Link to live example: (required)
https://codesandbox.io/p/sandbox/cranky-wind-nw84pf?file=%2Fsrc%2FDemo.tsx

Steps:

  1. Import AlertTitle
  2. Pass in variant props, e.g. <AlertTitle variant="h6">

Current behavior

Type error:

Type '{ children: string; variant: string; }' is not assignable to type 'IntrinsicAttributes & AlertTitleProps'.
  Property 'variant' does not exist on type 'IntrinsicAttributes & AlertTitleProps'.

Expected behavior

No type errors

Context

According to AlertTitle doc page this is a valid use case, however when doing this in practice we ran into type error.

If that is true, what is the best way to expose Typography props in AlertTitle? Is it just a matter of importing TypographyProps in AlertTitle.d.ts and let AlertTitleProps extends it? I'm not familiar with the codebase – thanks for checking!

export interface AlertTitleProps extends TypographyProps, StandardProps<React.HTMLAttributes<HTMLDivElement>> { ... }

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.2.1
  Binaries:
    Node: 20.11.0 - ~/.volta/tools/image/node/20.11.0/bin/node
    npm: 10.2.4 - ~/.volta/tools/image/node/20.11.0/bin/npm
    pnpm: 8.15.1 - ~/.volta/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.78
    Edge: Not Found
    Safari: 17.2.1

Search keywords: material-ui, AlertTitle

@d4rekanguok d4rekanguok added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 24, 2024
@zannager zannager added the component: alert This is the name of the generic UI component, not the React module! label Apr 24, 2024
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Apr 24, 2024
@ZeeshanTamboli
Copy link
Member

Thanks for reporting. It's a bug. Would you like to create a PR?

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process. typescript and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 14, 2024
@lucasgmelo
Copy link

Hi, I don't know if anyone is working on this... can you assign me?

@d4rekanguok
Copy link
Author

Go ahead @lucasgmelo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: alert This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. package: material-ui Specific to @mui/material typescript
Projects
None yet
Development

No branches or pull requests

6 participants