Answer the question
In order to leave comments, you need to log in
Why doesn't styled theme declaration fire when used in TyperScript?
Created a theme declaration following the example
// import original module declarations
import 'styled-components'
// and extend them!
declare module 'styled-components' {
export interface DefaultTheme {
borderRadius: string
colors: {
main: string
secondary: string
}
}
}
import { DefaultTheme } from 'styled-components'
const myTheme: DefaultTheme = {
borderRadius: '5px',
colors: {
main: 'cyan',
secondary: 'magenta',
},
}
export { myTheme }
import { createGlobalStyle } from 'styled-components';
export const MyComponent = styled.div`
borderRadius: ${props => props.theme.borderRadius};
`;
(parameter) props: any
Параметр "props" неявно имеет тип "any"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question