effect@3.12.12
Patch Changes
-
#4440
4018eaeThanks @gcanti! - Schema: add missing support for tuple annotations inTaggedRequest. -
#4439
543d36dThanks @gcanti! - Schedule: fix unsafetapOutputsignature.Previously,
tapOutputallowed using an output type that wasn't properly inferred, leading to potential runtime errors. Now, TypeScript correctly detects mismatches at compile time, preventing unexpected crashes.Before (Unsafe, Causes Runtime Error)
import { Effect, Schedule, Console } from "effect" const schedule = Schedule.once.pipe( Schedule.as<number | string>(1), Schedule.tapOutput((s: string) => Console.log(s.trim())) // ❌ Runtime error ) Effect.runPromise(Effect.void.pipe(Effect.schedule(schedule))) // throws: TypeError: s.trim is not a function
After (Safe, Catches Type Error at Compile Time)
import { Console, Schedule } from "effect" const schedule = Schedule.once.pipe( Schedule.as<number | string>(1), // ✅ Type Error: Type 'number' is not assignable to type 'string' Schedule.tapOutput((s: string) => Console.log(s.trim())) )
-
#4447
f70a65aThanks @gcanti! - Preserve functionlengthproperty inEffect.fn/Effect.fnUntraced, closes #4435Previously, functions created with
Effect.fnandEffect.fnUntracedalways had a.lengthof0, regardless of their actual number of parameters. This has been fixed so that thelengthproperty correctly reflects the expected number of arguments.Before
import { Effect } from "effect" const fn1 = Effect.fn("fn1")(function* (n: number) { return n }) console.log(fn1.length) // Output: 0 ❌ (incorrect) const fn2 = Effect.fnUntraced(function* (n: number) { return n }) console.log(fn2.length) // Output: 0 ❌ (incorrect)
After
import { Effect } from "effect" const fn1 = Effect.fn("fn1")(function* (n: number) { return n }) console.log(fn1.length) // Output: 1 ✅ (correct) const fn2 = Effect.fnUntraced(function* (n: number) { return n }) console.log(fn2.length) // Output: 1 ✅ (correct)
-
#4422
ba409f6Thanks @mikearnaldi! - Fix Context.Tag inference using explicit generics -
#4432
3d2e356Thanks @tim-smart! - use Map for Scope finalizers, to ensure they are always added