I quite often send data over a REST api which causes e.g. Date objects to be converted to strings. Currently I handle this like so:
type A = { many more properties }
type A_server = { time: Date } & A;
type A_client = { time: string } & A;
Is there a way to override types?
You could always do: {time: Date | string};
I don't think you can override types. That wouldn't work with the model where any type can depend on any type anywhere in the file.
PS. Also you should update to the newly release object type spread instead of using &.
Most helpful comment
You could always do:
{time: Date | string};I don't think you can override types. That wouldn't work with the model where any type can depend on any type anywhere in the file.
PS. Also you should update to the newly release object type spread instead of using
&.