Patch Changes
-
#4440
4018eae
Thanks @gcanti! - Schema: add missing support for tuple annotations inTaggedRequest
. -
#4439
543d36d
Thanks @gcanti! - Schedule: fix unsafetapOutput
signature.Previously,
tapOutput
allowed 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
f70a65a
Thanks @gcanti! - Preserve functionlength
property inEffect.fn
/Effect.fnUntraced
, closes #4435Previously, functions created with
Effect.fn
andEffect.fnUntraced
always had a.length
of0
, regardless of their actual number of parameters. This has been fixed so that thelength
property 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
ba409f6
Thanks @mikearnaldi! - Fix Context.Tag inference using explicit generics -
#4432
3d2e356
Thanks @tim-smart! - use Map for Scope finalizers, to ensure they are always added