effect icon indicating copy to clipboard operation
effect copied to clipboard

regression: Effect.liftPredicated stoped working correctly

Open titouancreach opened this issue 7 months ago • 0 comments

What version of Effect is running?

3.15.2

What steps can reproduce the bug?

https://effect.website/play/#1f6bb9163d58

export const nullableToRequired = <A, I>(schema: S.Schema<A, I>) =>
  S.transformOrFail(S.NullOr(schema), schema, {
    decode: (fromA, _option, ast, fromI) => {
      const val = pipe(
        fromI,
        Effect.liftPredicate(
          Predicate.isNotNull,
          () => new ParseResult.Type(ast, fromA, "not null expected"),
        ),
      );

      return val;
    },
    encode: (_toI, _option, _ast, toA) => Effect.succeed(toA),
    strict: true,
  })

This fail with Type 'Effect<I | null, any, never>' is not assignable to type 'Effect<I, ParseIssue, never>', liftPredicate should remove null for the return type

It was working the last versions

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

titouancreach avatar May 19 '25 16:05 titouancreach