material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

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

Open d4rekanguok opened this issue 10 months ago • 4 comments

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 avatar Apr 24 '24 11:04 d4rekanguok

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

ZeeshanTamboli avatar May 14 '24 15:05 ZeeshanTamboli

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

lucasgmelo avatar May 15 '24 21:05 lucasgmelo

Go ahead @lucasgmelo!

d4rekanguok avatar May 15 '24 22:05 d4rekanguok

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

@lucasgmelo I've assigned you ~ thanks!

mj12albert avatar May 16 '24 05:05 mj12albert