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
When using .andThrough() with a function that returns a Result, TypeScript reports a type mismatch, even though the function signature should be compatible.
When using .andThrough() with a function that returns a Result, TypeScript reports a type mismatch, even though the function signature should be compatible.
part of code
current return type
expected return type
Curiously, if I comment out .andThen((s) => ok(s)), the error disappears and the return type becomes exactly as expected.
typescript playground is here
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgUylANHCBrOBfOAMyghDgCIA7ZAN1RgAsSB3cgbgCgOBjAGwEMAzoLgBRNNAD6AQRQAPGMkoATEeJJREHOHDBRgNforhRk-ZREq8AnnEkxrYZAC4K6qdPZcd3S4JhQAK7cMNAAFCDIwvwA5i5w-vqUMQCUWjo6goFOUBFRgrHIKZwZcIzAggB09o7IcAC8bhJQMl46eBwdfEJqzZIAQvKKKr0a6br6hsam5pY2dg5OruTuLf1e2nC+lInBobmR0XGuicDJaQibmdmoeUdFJRnlVTVODU0aA234nVzb-nAevQAAqBABGvAqDH4ELqjTCgko-DAggYEBgrkuOhgwBgvHip2Sj2UUW4+jAOMsJwCZxinDwaXqAD5xsBCHAwgBCRHI1Hoyo4vFFcY6UwwQJQSgoNBhajMMR9aRhcioDSeFLFTYdHRsjncpEotEwSokwRk4AU4CWC5XEzIcWS6W5OUKz79ZWq6DrDWPbV2h1SnBhTV4TgcINYsq4-HLQX48joTam82WqkUZPkymUBOdFKbSr8FQAFQYSjCCMZLKDgg1+cLyhLJECMQYYSBsFBEKhMPxmqAA