Custom theme type overrides default theme type properties.
Closed this issue · 1 comments
DevYuns commented
Describe the bug
Custom theme type overrides default theme type even though I just make a bg
property.
The theme values are works but typescript complains.
To Reproduce
Steps to reproduce the behavior:
- Make a custom theme according to guide like below.
export const light = {
bg: {
default: '#FFFFFF',
},
};
export type CustomAppTheme = typeof light & DoobooTheme;
export const dark = {
bg: {
default: '#232323',
},
};
export const theme = {
light,
dark,
};
- Then, Create a type declaration file like below.
import '@emotion/react';
import type {DoobooTheme} from 'dooboo-ui';
import type {CustomAppTheme} from './theme';
type AllTheme = CustomAppTheme & DoobooTheme;
declare module '@emotion/react' {
export interface Theme extends AllTheme {
isMobile?: boolean;
isTablet?: boolean;
isDesktop?: boolean;
}
}
declare module 'dooboo-ui' {
export interface DoobooTheme extends AllTheme {
isMobile?: boolean;
isTablet?: boolean;
isDesktop?: boolean;
}
}
Expected behavior
Properties which are not customized should be typed.