Skip to content

Releases: JairusSW/try-as

v1.0.1

11 Mar 17:49

Choose a tag to compare

1.0.1

This patch release tightens Exception rethrow semantics, improves TypeScript tooling, and adds targeted regression coverage around the new behavior.

Highlights

  • throw err; now lowers to err.rethrow(); when err is statically typed as Exception or an Exception subclass.
  • Non-Exception identifier throws still use the existing fallback path:
    • __try_rethrow()
    • rethrow()
    • raw throw
  • TypeScript consumers now see Exception.rethrow(): never through the published declaration file.
  • Added focused tests covering:
    • typed local Exception rethrows
    • subclass inference
    • as Exception assertions
    • typed parameters
    • direct Exception.rethrow() calls
  • Updated README and architecture docs to reflect the new alias behavior.

Notable Behavior Change

If you previously relied on throw err; to preserve transformed exception-state propagation while err was typed as Exception, that path now intentionally uses the runtime rethrow() behavior instead.

Full changelog

  • fix: rewrite throw err to err.rethrow() when err is statically typed as Exception (or an Exception subclass), while keeping the generic identifier fallback path for non-Exception values
  • fix: preserve direct Exception.rethrow() runtime behavior while exposing it as never in the package type declarations for TS tooling
  • test: add focused rethrow semantics coverage for typed locals, subclass inference, assertions, typed parameters, and direct rethrow() calls
  • docs: document the new typed-Exception rethrow alias semantics in the README and architecture notes