UNPKG

@vaadin/hilla-file-router

Version:

Hilla file-based router

45 lines (44 loc) 1.91 kB
import type { ComponentType } from "react"; import type { AgnosticRoute, Module, ViewConfig } from "../types.js"; /** * Extends a router module's config with additional properties. The original * module config is preferred over the extension. * * @param module - The module to extend. * @param config - The extension config. * @returns * * @deprecated Use object spread syntax instead. */ export declare function extendModule(module: Module | null, config?: ViewConfig): Module; /** * Create a single framework-agnostic route object. Later, it can be transformed into a framework-specific route object, * e.g., the one used by React Router. * * @param path - A route path segment. * @param children - An array of child routes. * * @returns A framework-agnostic route object. */ export declare function createRoute(path: string, children?: readonly AgnosticRoute[]): AgnosticRoute; /** * Create a single framework-agnostic route object. Later, it can be transformed into a framework-specific route object, * e.g., the one used by React Router. * * @param path - A route path segment. * @param module - A module that exports a component and an optional config object. * @param children - An array of child routes. * * @deprecated Use `createRoute(path, component, config, children)` instead. */ export declare function createRoute(path: string, module: Module, children?: readonly AgnosticRoute[]): AgnosticRoute; /** * Create a single framework-agnostic route object. Later, it can be transformed into a framework-specific route object, * e.g., the one used by React Router. * * @param path - A route path segment. * @param component - A React component. * @param config - An optional config object. * @param children - An array of child routes. */ export declare function createRoute(path: string, component: ComponentType, config: ViewConfig | undefined, children?: readonly AgnosticRoute[]): AgnosticRoute;