fix(kit): correct render result types (#170)

This commit is contained in:
Daniel Roe 2021-05-26 19:44:08 +01:00 committed by GitHub
parent 6bde903273
commit 4c0ba0151d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,19 @@ type TemplateFile = string | {
}
type WatchEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'
interface PreloadFile {
asType: 'script' | 'style' | 'font'
extension: string
file: string
fileWithoutQuery: string
}
type RenderResult = {
html: string
cspScriptSrcHashes: string[]
error: any
redirected: boolean
preloadFiles: PreloadFile[]
}
export interface NuxtHooks {
// Don't break usage of untyped hooks
@ -64,9 +77,9 @@ export interface NuxtHooks {
'render:done': (server: Server) => HookResult
'listen': (listenerServer: any, listener: any) => HookResult
'server:nuxt:renderLoading': (req: IncomingMessage, res: ServerResponse) => HookResult
'render:route': (url: string, result: string, context: any) => HookResult
'render:routeDone': (url: string, result: string, context: any) => HookResult
'render:beforeResponse': (url: string, result: string, context: any) => HookResult
'render:route': (url: string, result: RenderResult, context: any) => HookResult
'render:routeDone': (url: string, result: RenderResult, context: any) => HookResult
'render:beforeResponse': (url: string, result: RenderResult, context: any) => HookResult
// @nuxt/vue-renderer
'render:resourcesLoaded': (resources: any) => HookResult