I have a type for my reducer such as:
export type Style = {
color: string;
(rest...)
}
export const initialState: Style = {
color: 'blue';
(rest...)
}
I have a component that takes in a style object and the properties are optional and simply overwrites the current state of the style. The type looks like this:
export type InputStyle = {
color?: string;
(rest?...)
}
So I basically have to create two duplicate types, except one has all optional properties, and one doesn't. Is there a better pattern for this? My intuition says this is not the right way.