I'm trying to use styled-components with typescript and with a BEM structure
So I have a simple example like
index.tsx
import styled from 'styled-components'
import Header from './Header'
interface ICard {
Header:
}
const Card = styled.div`
border: 1px solid gray;
padding: 10px;
`
Card.Header = Header
export default Card
Header.tsx
import styled from 'styled-components'
const Header = styled.h1`
color: #313c53;
font-size: 1.2em;
line-height: 1.5;
`
export default Header
And in the mark up
<Card>
<Card.Header>
Header
</Card.Header>
</Card>
My problem is in the index.tsx, I'm getting an error here Card.Header = Header
Type 'StyledComponent<"label", any, {}, never>' is not assignable to type 'never'.ts(2322)
I know this is typescript related and I have been trying to fix an interface but can't get it to work.
How can I fix this typescript error?