type-alias / @typed/navigation

BeforeNavigationHandler

Selects optional pre-commit work for a navigation event.

Package version
1.0.0-beta.13
Category
Navigation hooks
Since
1.0.0

Import

import type { BeforeNavigationHandler } from "@typed/navigation";

Signatures

export type BeforeNavigationHandler<R, R2> = (event: BeforeNavigationEvent) => Effect.Effect<Option.Option<Effect.Effect<unknown, RedirectError | CancelNavigation, R2>>, RedirectError | CancelNavigation, R>;

Why

The outer Effect decides whether a handler participates; the selected inner Effect can redirect or cancel. This preserves declaration order and separates cheap selection from retained work.

Ownership and lifetime

Registration captures the handler’s Effect context and is owned by its Scope. The active transition runs selected effects sequentially and interruption releases normal Effect resources.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source