Repository navigation
v0.57.0
Minor Changes
-
#500
acc2d43Thanks @mattiamanzati! - Add newannotatecodegen that automatically adds type annotations to exported constants based on their initializer types. This codegen can be used by adding// @effect-codegens annotatecomments 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
b188b74Thanks @mattiamanzati! - Add new diagnosticunnecessaryFailYieldableErrorthat warns when usingyield* Effect.fail()with yieldable error types. The diagnostic suggests yielding the error directly instead of wrapping it withEffect.fail(), as yieldable errors (likeData.TaggedErrorandSchema.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();