Skip to content

Commit

Permalink
[Avatar] fix TypeScript error on imgProps.sx (#30255)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad-reza619 committed Dec 28, 2021
1 parent 737ec06 commit 98c9aad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/mui-material/src/Avatar/Avatar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export interface AvatarTypeMap<P = {}, D extends React.ElementType = 'div'> {
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
* It can be used to listen for the loading error event.
*/
imgProps?: React.ImgHTMLAttributes<HTMLImageElement>;
imgProps?: React.ImgHTMLAttributes<HTMLImageElement> & {
sx?: SxProps<Theme>;
};
/**
* The `sizes` attribute for the `img` element.
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/mui-material/src/Avatar/Avatar.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as React from 'react';
import Avatar from '@mui/material/Avatar';

function ImgPropsShouldSupportSx() {
<Avatar imgProps={{ sx: { objectFit: 'contain' } }} />;
}

0 comments on commit 98c9aad

Please sign in to comment.