I have a module that is made with styled-components
and export a theme
I want to combine the exported theme for styled from the module with my application theme.
I have tried the following in theme.ts
:
import { theme as idCheckTheme } from '@pass-culture/id-check/src/theme'import { DefaultTheme } from 'styled-components/native'import './styled.d'export const theme: DefaultTheme = { ...idCheckTheme, appBarHeight: 64,}
I have also copied the styled.d.ts
and added appBarHeight: number
at the top.
When I start my application, I have the following error:
Property 'appBarHeight' is missing in type '{ colors: { black: ColorsEnum; error: ColorsEnum; greenValid: ColorsEnum; greyDark: ColorsEnum; greyMedium: ColorsEnum; greyLight: ColorsEnum; ... 4 more ...; primaryDark: ColorsEnum; }; typography: { ...; }; buttons: { ...; }; }' but required in type 'DefaultTheme'. TS2741
I expected it to work, typing isn't complaining in IntelliJ.
How can I combine a styled-components
theme into a new DefaultTheme
with TypeScript?