fix(vue-app): fix context `req` and `res` types (#5560)

This commit is contained in:
Kevin Marrec 2019-04-20 11:16:26 +02:00 committed by Pooya Parsa
parent 30c2b9542e
commit ccf23a07ed
1 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import Vue from 'vue'
import VueRouter, { Route } from 'vue-router'
import { Store } from 'vuex'
import { IncomingMessage, ServerResponse } from 'http'
// augment typings of NodeJS.Process
import './process'
@ -17,15 +18,15 @@ export interface Context {
/**
* @deprecated Use process.client instead
*/
isClient: boolean;
isClient: boolean
/**
* @deprecated Use process.server instead
*/
isServer: boolean;
isServer: boolean
/**
* @deprecated Use process.static instead
*/
isStatic: boolean;
isStatic: boolean
isDev: boolean
isHMR: boolean
route: Route
@ -34,13 +35,13 @@ export interface Context {
params: Route['params']
payload: any
query: Route['query']
req: Request
res: Response
redirect (status: number, path: string, query?: Route['query']): void
redirect (path: string, query?: Route['query']): void
error (params: ErrorParams): void
req: IncomingMessage
res: ServerResponse
redirect(status: number, path: string, query?: Route['query']): void
redirect(path: string, query?: Route['query']): void
error(params: ErrorParams): void
nuxtState: NuxtState
beforeNuxtRender (fn: (params: { Components: VueRouter['getMatchedComponents'], nuxtState: NuxtState }) => void): void
beforeNuxtRender(fn: (params: { Components: VueRouter['getMatchedComponents'], nuxtState: NuxtState }) => void): void
}
export type Middleware = string | ((ctx: Context, cb: Function) => Promise<void> | void)