tss-react
tss-react copied to clipboard
Add support for StyledOptions, as a last argument of `withStyles` function
This is a proposal to add the same options
object as styled
emotion function has, as a last argument of withStyles
function.
Motivation
Right now to not pass an argument down to component, I need to write:
const RightDrawer = withStyles(
({
$width,
...props
}: React.ComponentProps<typeof Drawer> & { $width: number }) => (
<Drawer {...props} />
),
(theme, props) => ({
paper: {
...,
},
})
);
Instead, I would like to have:
const RightDrawer = withStyles(Drawer,
(theme, props) => ({
paper: {
...,
},
}),
{ shouldForwardProp: (propName: string) => !propName.startsWith("$") }
);
Hi @matyas-igor,
I like this proposal.
I have no time to implement it in the short therm but if you submit a PR I will happily review and merge it.
In the end I figured out it was imposible to type it correctly so I give up sorry.