Verwendung

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>;
  }
}

Typdeklaration

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

Typ

ts
{} extends P ? (params?: P) => Destination<R> : (params: P) => Destination<R>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.