Usage

Use typed destinations

tsx
import type { RouteTo } from 'kuito';

declare module 'kuito' {
  interface Routes {
    index: RouteTo;
    show: RouteTo<{ id: number }>;
    profile: RouteTo;
    compose: RouteTo<{}, string>;
  }
}

Type declaration

ts
export type RouteTo<P extends object = {}, R = undefined> = {} extends P
  ? (params?: P) => Destination<R>
  : (params: P) => Destination<R>;

Type

ts
{} extends P ? (params?: P) => Destination<R> : (params: P) => Destination<R>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.