Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 14 Feb 00:32
· 37 commits to main since this release
9324b18

Patch Changes

  • #4440 4018eae Thanks @gcanti! - Schema: add missing support for tuple annotations in TaggedRequest.

  • #4439 543d36d Thanks @gcanti! - Schedule: fix unsafe tapOutput 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 function length property in Effect.fn / Effect.fnUntraced, closes #4435

    Previously, functions created with Effect.fn and Effect.fnUntraced always had a .length of 0, regardless of their actual number of parameters. This has been fixed so that the length 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