Preference of 1st Overload in Typescript Schemas

Typescript always prefer the 1st overload instead of the 3rd one when using schemas defined as Schema<From> and To is omitted.

For example the following code:
  Schema.transform(
    Schema.NonEmpty,
    Schema.DateFromString.pipe(Schema.validDate()),
    (date) => DateFNS.formatISO(date, { representation: "complete" }),
    (date) => new Date(date),
  )

errors with:
Type '<A>(self: Schema<A, unknown>) => Schema<A, string>' is not assignable to type 'Schema<any, any> | Schema<never, never> | PropertySignature<any, boolean, any, boolean> | PropertySignature<never, boolean, never, boolean>'.

but passing, for example, Schema.DateFromString as from argument works.

Is it something that could be fixed in lib without having to make To param in
Schema
?
Was this page helpful?