I have some objects where I want to change the Codec of one Property. Fort example I have a struct with a date field. Depending on 3rd system apis sometime the input value comes in form of a timestamp, sometimes in form of an ISO string. Is it possible without redeclaring everything else?
import * as COD from "io-ts/Codec";
const TimestampDateCodec: COD.Codec<unknown, number, Date> = {};
const IsoStringDateCodec: COD.Codec<unknown, string, Date> = {};
const current = COD.struct({
id: COD.string,
// a lot of other props...
someDate: TimestampDateCodec, // change this to IsoStringDateCodec without redefining the whole struct
});