You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to better align with the implementation of struct in Codec, where this inference issue does not happen.
However, the type is then inferred as:
typeA=Decoder<unknown,{_tag: unknown}>;
I suspect the implementation of TypeOf to be at fault there but I am not familiar with the theory behind Kleisli types, so it's become difficult for me to debug any further.
Additional context
I stumbled upon this after upgrading to TypeScript 4.8 where it caused build errors. My workaround to this issue was to cast the string to a const:
@vecerek thanks for the bug report, I'm investigating. Looks like literal doesn't work as expected inside a struct with typescript@4.8 (while it works with typescript@4.7 and earlier versions)
🐛 Bug report
Current Behavior
Expected behavior
I expect the type to be inferred as:
Reproducible example
Suggested solution(s)
I tried changing
struct
in the Decoder to:to better align with the implementation of struct in
Codec
, where this inference issue does not happen.However, the type is then inferred as:
I suspect the implementation of
TypeOf
to be at fault there but I am not familiar with the theory behind Kleisli types, so it's become difficult for me to debug any further.Additional context
I stumbled upon this after upgrading to TypeScript 4.8 where it caused build errors. My workaround to this issue was to cast the string to a const:
Your environment
Which versions of io-ts are affected by this issue? Did this work in previous versions of io-ts?
This issue should be reproducible on the master branch. I don't know if the inference ever worked.
The text was updated successfully, but these errors were encountered: