mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
feat(types): add basic types for Nuxt interface (#9772)
This commit is contained in:
parent
7ecb003c7f
commit
c493723437
5
packages/types/config/module.d.ts
vendored
5
packages/types/config/module.d.ts
vendored
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Configuration as WebpackConfiguration } from 'webpack'
|
import type { Configuration as WebpackConfiguration } from 'webpack'
|
||||||
|
import type { Nuxt } from '../nuxt'
|
||||||
import type { NuxtOptionsLoaders } from './build'
|
import type { NuxtOptionsLoaders } from './build'
|
||||||
import type { NuxtRouteConfig } from './router'
|
import type { NuxtRouteConfig } from './router'
|
||||||
import type { NuxtOptionsServerMiddleware } from './server-middleware'
|
import type { NuxtOptionsServerMiddleware } from './server-middleware'
|
||||||
@ -57,8 +58,8 @@ interface ModuleThis {
|
|||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
addModule (moduleOpts: NuxtOptionsModule, paths?: string[]): Promise<any>
|
addModule (moduleOpts: NuxtOptionsModule, paths?: string[]): Promise<any>
|
||||||
options: NuxtOptions
|
options: NuxtOptions
|
||||||
nuxt: any // TBD
|
nuxt: Nuxt
|
||||||
[key: string]: any // TBD
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Module<T = any> = (this: ModuleThis, moduleOptions: T) => Promise<void> | void
|
export type Module<T = any> = (this: ModuleThis, moduleOptions: T) => Promise<void> | void
|
||||||
|
16
packages/types/nuxt.d.ts
vendored
Normal file
16
packages/types/nuxt.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import type { RequestListener } from 'http'
|
||||||
|
import type { NuxtOptions } from './config'
|
||||||
|
|
||||||
|
export interface Nuxt {
|
||||||
|
options: NuxtOptions,
|
||||||
|
server: { app: RequestListener },
|
||||||
|
ready: () => any
|
||||||
|
close: (callback?: Function) => any
|
||||||
|
resolver: any
|
||||||
|
moduleContainer: any
|
||||||
|
resolveAlias(path: string): string
|
||||||
|
resolvePath(path: string, opts?: any): string
|
||||||
|
renderRoute(...args: any[]): any
|
||||||
|
renderAndGetWindow(url: string, opts?: any, config?: any): any
|
||||||
|
[key: string]: any
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user