UNPKG

1.27 kBTypeScriptView Raw
1/**
2 * Extends interfaces in Vue.js
3 */
4
5import Vue from 'vue'
6import { MetaInfo } from 'vue-meta'
7import { Route } from 'vue-router'
8import { Context, Middleware, Transition, NuxtApp } from './index'
9import { NuxtRuntimeConfig } from '../config/runtime'
10
11declare module 'vue/types/options' {
12 interface ComponentOptions<V extends Vue> {
13 asyncData?(ctx: Context): Promise<object | void> | object | void
14 fetch?(ctx: Context): Promise<void> | void
15 fetchDelay?: number
16 fetchOnServer?: boolean | (() => boolean)
17 head?: MetaInfo | (() => MetaInfo)
18 key?: string | ((to: Route) => string)
19 layout?: string | ((ctx: Context) => string)
20 loading?: boolean
21 middleware?: Middleware | Middleware[]
22 scrollToTop?: boolean
23 transition?: string | Transition | ((to: Route, from: Route | undefined) => string | Transition)
24 validate?(ctx: Context): Promise<boolean> | boolean
25 watchQuery?: boolean | string[] | ((newQuery: Route['query'], oldQuery: Route['query']) => boolean)
26 meta?: { [key: string]: any }
27 }
28}
29
30declare module 'vue/types/vue' {
31 interface Vue {
32 $config: NuxtRuntimeConfig
33 $nuxt: NuxtApp
34 $fetch(): void
35 $fetchState: {
36 error: Error | null
37 pending: boolean
38 timestamp: number
39 }
40 }
41}
42
\No newline at end of file