I looking into styled-components and trying the examples from the website but I also wanted to use TypeScript.
I have this simple example here
import React from 'react'; import './App.css'; import styled from 'styled-components'; interface IProps{ primary: boolean } const App:React.FC<IProps> = ({primary}) => { return ( <div className="App"> <h1>Styled Components</h1> <Button>Normal</Button> <Button primary>Primary</Button> </div> ); } const Button = styled.button` background: ${props => props.primary ? 'red' : 'white'}; color: ${props => props.primary ? 'white' : 'red'}; font-size: 1em; margin: 1em; padding: 0.25em 1em; border: 1px solid green; border-radius: 3px; ` export default App; but I'm getting errors on the primary prop
I getting the error
Property 'primary' does not exist on type 'ThemedStyledProps<Pick<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "form" | ... 264 more ... | "onTransitionEndCapture"> & { ...; }, any>' Ho can I use styled-components with TypeScript?