UNPKG

1.08 kBTypeScriptView Raw
1import { Type } from '../src/facade/lang';
2import { RegexSerializer } from './rules/route_paths/regex_route_path';
3/**
4 * `RouteDefinition` defines a route within a {@link RouteConfig} decorator.
5 *
6 * Supported keys:
7 * - `path` or `aux` (requires exactly one of these)
8 * - `component`, `loader`, `redirectTo` (requires exactly one of these)
9 * - `name` (optional)
10 * - `data` (optional)
11 *
12 * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}.
13 */
14export interface RouteDefinition {
15 path?: string;
16 aux?: string;
17 regex?: string;
18 regex_group_names?: string[];
19 serializer?: RegexSerializer;
20 component?: Type | ComponentDefinition;
21 loader?: () => Promise<Type>;
22 redirectTo?: any[];
23 name?: string;
24 data?: any;
25 useAsDefault?: boolean;
26}
27/**
28 * Represents either a component type (`type` is `component`) or a loader function
29 * (`type` is `loader`).
30 *
31 * See also {@link RouteDefinition}.
32 */
33export interface ComponentDefinition {
34 type: string;
35 loader?: () => Promise<Type>;
36 component?: Type;
37}