From 501c58608c046860fc8e8e746859000b99143783 Mon Sep 17 00:00:00 2001 From: Kevin Marrec Date: Sat, 11 May 2019 18:50:14 +0200 Subject: [PATCH] fix(ts): fix `extendRoutes` method type (#5700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Stalder --- packages/config/types/index.d.ts | 3 ++- packages/config/types/router.d.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/config/types/index.d.ts b/packages/config/types/index.d.ts index 4649988ff9..021775e726 100644 --- a/packages/config/types/index.d.ts +++ b/packages/config/types/index.d.ts @@ -9,7 +9,7 @@ import { NuxtConfigurationLoading, NuxtConfigurationLoadingIndicator } from './l import { NuxtConfigurationModule } from './module' import { NuxtConfigurationPlugin } from './plugin' import { NuxtConfigurationRender } from './render' -import { NuxtConfigurationRouter } from './router' +import { NuxtConfigurationRouter, NuxtRouteConfig } from './router' import { NuxtConfigurationServer } from './server' import { NuxtConfigurationServerMiddleware } from './server-middleware' import { NuxtConfigurationVueConfiguration } from './vue-configuration' @@ -65,6 +65,7 @@ export { NuxtConfigurationPlugin as Plugin, NuxtConfigurationRender as Render, NuxtConfigurationRouter as Router, + NuxtRouteConfig as RouteConfig, NuxtConfigurationServer as Server, NuxtConfigurationServerMiddleware as ServerMiddleware, NuxtConfigurationVueConfiguration as VueConfiguration, diff --git a/packages/config/types/router.d.ts b/packages/config/types/router.d.ts index e7f2e65d6f..d57fe257f4 100644 --- a/packages/config/types/router.d.ts +++ b/packages/config/types/router.d.ts @@ -5,11 +5,15 @@ * https://router.vuejs.org/api/#router-construction-options */ -import { RouterOptions, Route } from 'vue-router' +import { RouterOptions, RouteConfig } from 'vue-router' + +export interface NuxtRouteConfig extends RouteConfig { + chunkNames: { [key: string]: string } +} export interface NuxtConfigurationRouter extends RouterOptions { routeNameSplitter?: string - extendRoutes?: (routes: Route[], resolve: (...pathSegments: string[]) => string) => void + extendRoutes?(routes: NuxtRouteConfig[], resolve: (...pathSegments: string[]) => string): void linkPrefetchedClass?: string middleware?: string | string[] prefetchLinks?: boolean