UNPKG

2.04 kBTypeScriptView Raw
1declare module '@ember/routing/lib/dsl' {
2 import type { InternalFactory } from '@ember/-internals/owner';
3 import type { MatchCallback } from 'route-recognizer';
4 import type { EngineInfo, EngineRouteInfo } from '@ember/routing/lib/engines';
5 export interface RouteOptions {
6 path?: string;
7 resetNamespace?: boolean;
8 serialize?: (
9 model: {},
10 params: string[]
11 ) => {
12 [key: string]: unknown | undefined;
13 };
14 overrideNameAssertion?: boolean;
15 }
16 export interface MountOptions {
17 path?: string;
18 as?: string;
19 resetNamespace?: boolean;
20 }
21 export interface DSLCallback {
22 (this: DSL): void;
23 }
24 export interface DSL {
25 route(name: string): void;
26 route(name: string, callback: DSLCallback): void;
27 route(name: string, options: RouteOptions): void;
28 route(name: string, options: RouteOptions, callback: DSLCallback): void;
29 mount(name: string): void;
30 mount(name: string, options: MountOptions): void;
31 }
32 export interface DSLImplOptions {
33 enableLoadingSubstates: boolean;
34 engineInfo?: EngineInfo;
35 addRouteForEngine(name: string, routeOptions: EngineRouteInfo): void;
36 resolveRouteMap(name: string): InternalFactory<any, any>;
37 }
38 export default class DSLImpl implements DSL {
39 parent: string | null;
40 matches: Array<Object | undefined>;
41 enableLoadingSubstates: boolean;
42 explicitIndex: boolean;
43 options: DSLImplOptions;
44 constructor(name: string | null | undefined, options: DSLImplOptions);
45 route(name: string): void;
46 route(name: string, callback: DSLCallback): void;
47 route(name: string, options: RouteOptions): void;
48 route(name: string, options: RouteOptions, callback: DSLCallback): void;
49 push(
50 url: string,
51 name: string,
52 callback?: MatchCallback,
53 serialize?: (
54 model: {},
55 params: string[]
56 ) => {
57 [key: string]: unknown | undefined;
58 }
59 ): void;
60 generate(): MatchCallback;
61 mount(_name: string, options?: MountOptions): void;
62 }
63}