I found this code snippet on https://mui.com/system/the-sx-prop/ and tried implementing it, but encountered a TypeScript error.
sx={(theme: Theme): SxProps<Theme> | undefined => ({
...theme.typography.body,
color: theme.palette.primary.main,
})}
Type '(theme: Theme) => SxProps<Theme> | undefined' is not compatible with type 'SxProps<Theme> | undefined'.
Type '(theme: Theme) => SxProps<Theme> | undefined' is not assignable to type 'CSSSelectorObject<Theme>'.
Index signature for type 'string' is missing in type '(theme: Theme) => SxProps<Theme> | undefined'.ts(2322)
StatusBar.component.tsx(46, 12): Did you mean to call this expression?