Skip to content

Commit

Permalink
Fix remaining types issues (on mui side)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai authored and aarongarciah committed Jul 5, 2024
1 parent b524d84 commit 0e36678
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/mui-base/test/describeConformanceUnstyled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function testSlotPropsProp(
});
}

function testClassName(element: React.ReactElement, getOptions: () => ConformanceOptions) {
function testClassName(element: React.ReactElement<any>, getOptions: () => ConformanceOptions) {
it('applies the className to the root component', async () => {
const { render } = getOptions();

Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ const ButtonGroup = React.forwardRef(function ButtonGroup(inProps, ref) {
}
const extraProps: Record<string, any> = {};
if (isMuiElement(child, ['Divider'])) {
extraProps.inset = 'inset' in child.props ? child.props.inset : 'context';
extraProps.inset = (child.props as any).inset ?? 'context';

const dividerOrientation = orientation === 'vertical' ? 'horizontal' : 'vertical';
extraProps.orientation =
'orientation' in child.props ? child.props.orientation : dividerOrientation;
extraProps.orientation = (child.props as any).orientation ?? dividerOrientation;
extraProps.role = 'presentation';
extraProps.component = 'span';
}
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ const Card = React.forwardRef(function Card(inProps, ref) {
}
const extraProps: Record<string, any> = {};
if (isMuiElement(child, ['Divider'])) {
extraProps.inset = 'inset' in child.props ? child.props.inset : 'context';
extraProps.inset = (child.props as any)?.inset ?? 'context';

const dividerOrientation = orientation === 'vertical' ? 'horizontal' : 'vertical';
extraProps.orientation =
'orientation' in child.props ? child.props.orientation : dividerOrientation;
extraProps.orientation = (child.props as any)?.orientation ?? dividerOrientation;
}
if (index === 0) {
extraProps['data-first-child'] = '';
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-joy/src/ListItem/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const ListItem = React.forwardRef(function ListItem(inProps, ref) {
...(index === 0 && { 'data-first-child': '' }),
...(isMuiElement(child, ['ListItem']) && {
// The ListItem of ListItem should not be 'li'
component: child.props.component || 'div',
component: (child.props as any).component || 'div',
}),
})
: child,
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/ModalDialog/ModalDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ const ModalDialog = React.forwardRef(function ModalDialog(inProps, ref) {
}
const extraProps: Record<string, any> = {};
if (isMuiElement(child, ['Divider'])) {
extraProps.inset = 'inset' in child.props ? child.props.inset : 'context';
extraProps.inset = (child.props as any).inset ?? 'context';

const dividerOrientation = orientation === 'vertical' ? 'horizontal' : 'vertical';
extraProps.orientation =
'orientation' in child.props ? child.props.orientation : dividerOrientation;
extraProps.orientation = (child.props as any).orientation ?? dividerOrientation;
}
if (index === 0) {
extraProps['data-first-child'] = '';
Expand Down
5 changes: 2 additions & 3 deletions packages/mui-joy/src/ToggleButtonGroup/ToggleButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,10 @@ const ToggleButtonGroup = React.forwardRef(function ToggleButtonGroup<
}
const extraProps: Record<string, any> = {};
if (isMuiElement(child, ['Divider'])) {
extraProps.inset = 'inset' in child.props ? child.props.inset : 'context';
extraProps.inset = (child.props as any).inset ?? 'context';

const dividerOrientation = orientation === 'vertical' ? 'horizontal' : 'vertical';
extraProps.orientation =
'orientation' in child.props ? child.props.orientation : dividerOrientation;
extraProps.orientation = (child.props as any).orientation ?? dividerOrientation;
extraProps.role = 'presentation';
extraProps.component = 'span';
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/styles/styled.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ function Button({
return styles;
},
startIcon: ({ ownerState: { startIcon, endIcon } }) => [
startIcon && { marginRight: 8 },
endIcon && { marginLeft: 8 },
!!startIcon && { marginRight: 8 },
!!endIcon && { marginLeft: 8 },
],
},
},
Expand Down
8 changes: 4 additions & 4 deletions packages/mui-utils/src/getDisplayName/getDisplayName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ describe('utils/getDisplayName.js', () => {
));
NamedForwardRefComponent.displayName = 'Div';

const AnonymousMemoComponent = React.memo((props, ref) => <div {...props} ref={ref} />);
const AnonymousMemoComponent = React.memo((props) => <div {...props} />);

const MemoComponent = React.memo(function Div(props, ref) {
return <div {...props} ref={ref} />;
const MemoComponent = React.memo(function Div(props) {
return <div {...props} />;
});

const NamedMemoComponent = React.memo((props, ref) => <div {...props} ref={ref} />);
const NamedMemoComponent = React.memo((props) => <div {...props} />);
NamedMemoComponent.displayName = 'Div';

const NamedContext = React.createContext(null);
Expand Down

0 comments on commit 0e36678

Please sign in to comment.