Using styled-components, with normal React.js I can do like:
const Container = styled.div({
userSelect: `none !important`,
})
however with TypeScript I get the error:
Argument of type '{ userSelect: string; }' is not assignable to parameter of type 'TemplateStringsArray'.
Object literal may only specify known properties, and 'userSelect' does not exist in type 'TemplateStringsArray'.ts(2345)
What's the best way to fix this?
I don't want to use the styled.div template strings approach as I find it a lot less flexible.
For example with template strings we can't do things like:
const flex = {
flex: display: flex,
col: flexDirection: `column`
}
const FlexRow = styled.div({
...flex.flex,
})
const FlexCol = styled.div({
...flex.flex,
...flex.col,
})