Skip to content

v0.57.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 17:57
· 235 commits to main since this release
f51c27a

Minor Changes

  • #500 acc2d43 Thanks @mattiamanzati! - Add new annotate codegen that automatically adds type annotations to exported constants based on their initializer types. This codegen can be used by adding // @effect-codegens annotate comments above variable declarations.

    Example:

    // @effect-codegens annotate
    export const test = Effect.gen(function* () {
      if (Math.random() < 0.5) {
        return yield* Effect.fail("error");
      }
      return 1 as const;
    });
    // Becomes:
    // @effect-codegens annotate:5fce15f7af06d924
    export const test: Effect.Effect<1, string, never> = Effect.gen(function* () {
      if (Math.random() < 0.5) {
        return yield* Effect.fail("error");
      }
      return 1 as const;
    });

    The codegen automatically detects the type from the initializer and adds the appropriate type annotation, making code more explicit and type-safe.

  • #497 b188b74 Thanks @mattiamanzati! - Add new diagnostic unnecessaryFailYieldableError that warns when using yield* Effect.fail() with yieldable error types. The diagnostic suggests yielding the error directly instead of wrapping it with Effect.fail(), as yieldable errors (like Data.TaggedError and Schema.TaggedError) can be yielded directly in Effect generators.

    Example:

    // ❌ Unnecessary Effect.fail wrapper
    yield * Effect.fail(new DataTaggedError());
    
    // ✅ Direct yield of yieldable error
    yield * new DataTaggedError();