all repos — kitten @ 7069b00b3a14cefdd48236a2ad08cb3377011751

pkgs/router/changelogs/1.6.0.md (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
# [1.6.0] 2026-07-09

in this release i added strictly-typed post-execution flow handlers, which i've
dubbed "afterware". afterwares run after any command, context menu, or component
finishes executing, regardless of whether it completed cleanly, threw an exception,
or was halted by middleware.

afterwares operate sequentially inside a safe `finally` block and receive:

- the accumulated context passed down by your middlewares,
- any uncaught execution error (or `null` if the handler succeeded), and
- the return value of your interaction handler.

to prevent type safety degradation, i've implemented strict compile-time type
inference for these handlers. when you register an afterware via `.after<Res>()` on
your builder:

- the `result` argument inside your afterware is strictly typed as `Res | undefined`, and
- TypeScript will strictly verify that all commands, subcommands, and components
  produced by that builder return a type assignable to `Res`.

you can find more information and a complete example under the "using afterware"
section of the [Getting Started] guide.

[Getting Started]: ../GET-STARTED.md