Skip to content

Commit

Permalink
Revert "This should fix types"
Browse files Browse the repository at this point in the history
This reverts commit ba2658e.
  • Loading branch information
ItalyPaleAle committed Dec 2, 2020
1 parent ba2658e commit 2ea2571
Showing 1 changed file with 35 additions and 45 deletions.
80 changes: 35 additions & 45 deletions Router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,51 +160,41 @@ export type RouteLoadingEvent = RouterEvent<RouteDetail>
/** Event type for routeLoaded */
export type RouteLoadedEvent = RouterEvent<RouteDetailLoaded>

/**
* Interface for the props for the Router component
*/
interface RouterPropsDef {
/**
* Dictionary of all routes, in the format `'/path': component`.
*
* For example:
* ````js
* import HomeRoute from './routes/HomeRoute.svelte'
* import BooksRoute from './routes/BooksRoute.svelte'
* import NotFoundRoute from './routes/NotFoundRoute.svelte'
* routes = {
* '/': HomeRoute,
* '/books': BooksRoute,
* '*': NotFoundRoute
* }
* ````
*/
routes: RouteDefinition
/**
* Optional prefix for the routes in this router. This is useful for example in the case of nested routers.
*/
prefix?: string | RegExp
/**
* If set to true, the router will restore scroll positions on back navigation
* and scroll to top on forward navigation.
*/
restoreScrollState?: boolean
}

/**
* Interface for the events for the Router component
*/
interface RouterEventsDef {
routeEvent: CustomEvent,
conditionsFailed: ConditionsFailedEvent
routeLoading: RouteLoadingEvent
routeLoaded: RouteLoadedEvent
}

/**
* Router component
*/
export default class Router extends SvelteComponent<
RouterPropsDef,
RouterEventsDef
> {}
export default class Router extends SvelteComponent {
// Props
$$prop_def: {
/**
* Dictionary of all routes, in the format `'/path': component`.
*
* For example:
* ````js
* import HomeRoute from './routes/HomeRoute.svelte'
* import BooksRoute from './routes/BooksRoute.svelte'
* import NotFoundRoute from './routes/NotFoundRoute.svelte'
* routes = {
* '/': HomeRoute,
* '/books': BooksRoute,
* '*': NotFoundRoute
* }
* ````
*/
routes: RouteDefinition,
/**
* Optional prefix for the routes in this router. This is useful for example in the case of nested routers.
*/
prefix?: string | RegExp,
/**
* If set to true, the router will restore scroll positions on back navigation
* and scroll to top on forward navigation.
*/
restoreScrollState?: boolean
}

$on(event: 'routeEvent', callback: (event: CustomEvent) => void): () => void
$on(event: 'conditionsFailed', callback: (event: ConditionsFailedEvent) => void): () => void
$on(event: 'routeLoading', callback: (event: RouteLoadingEvent) => void): () => void
$on(event: 'routeLoaded', callback: (event: RouteLoadedEvent) => void): () => void
}

0 comments on commit 2ea2571

Please sign in to comment.