Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): add basic types for Nuxt interface #9772

Merged
merged 5 commits into from Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/types/config/module.d.ts
Expand Up @@ -5,6 +5,7 @@
*/

import type { Configuration as WebpackConfiguration } from 'webpack'
import type { Nuxt } from '../nuxt'
import type { NuxtOptionsLoaders } from './build'
import type { NuxtRouteConfig } from './router'
import type { NuxtOptionsServerMiddleware } from './server-middleware'
Expand Down Expand Up @@ -57,8 +58,8 @@ interface ModuleThis {
// eslint-disable-next-line no-use-before-define
addModule (moduleOpts: NuxtOptionsModule, paths?: string[]): Promise<any>
options: NuxtOptions
nuxt: any // TBD
[key: string]: any // TBD
nuxt: Nuxt
[key: string]: any
}

export type Module<T = any> = (this: ModuleThis, moduleOptions: T) => Promise<void> | void
Expand Down
16 changes: 16 additions & 0 deletions packages/types/nuxt.d.ts
@@ -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
}