Great post! Had a little trouble with the code as written -- might be my Typescript config or some update to fp-ts. Had to provide type arguments to flow of decodeWith due to an "Type argument cannot be inferred from usage" error. Once decodeWith was changed to the following, it all worked:
const decodeWith = <A>(decoder: t.Decoder<unknown, A>) =>
flow<Array<A>,Validation<A>, E.Either<Error, A>, TE.TaskEither<Error, A>>(
decoder.decode,
E.mapLeft(errors => new Error(failure(errors as Array<ValidationError>).join('\n'))),
TE.fromEither
)
Thank you!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great post! Had a little trouble with the code as written -- might be my Typescript config or some update to fp-ts. Had to provide type arguments to flow of decodeWith due to an "Type argument cannot be inferred from usage" error. Once decodeWith was changed to the following, it all worked:
Thank you!