gcanti / io-ts-types

A collection of codecs and combinators for use with io-ts
https://gcanti.github.io/io-ts-types/
MIT License
311 stars 40 forks source link

Add output indexed types to option and either #171

Closed mlegenhausen closed 1 year ago

mlegenhausen commented 1 year ago

This PR adds indexed output types to the option and either codecs. This solves the problem that it is currently not possible to do Json.pipe(option(t.unknown)) or Json.pipe(either(t.string, t.unknown)) as the fp-ts types can not be assigned to JsonRecord. As we don't want to loose the interface representation in fp-ts it is the best to add an indexed version to io-ts-types.

This is related to https://github.com/gcanti/fp-ts/issues/1734

gcanti commented 1 year ago

it is currently not possible to do Json.pipe(option(t.unknown))

We should add some tests