From 603dfbeb1f04ea26d2b03817f1ec170a90084fd3 Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin Date: Thu, 29 Dec 2022 21:02:15 +0400 Subject: [PATCH] chore: fix missing ts --- types/index.d.ts | 240 ++++++++++++++++++++++------------------------- 1 file changed, 110 insertions(+), 130 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 152459637..cb5c1bc32 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -115,148 +115,128 @@ export = wdm; * @param {Options} [options] * @returns {API} */ -declare function wdm< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse ->( - compiler: Compiler | MultiCompiler, - options?: Options | undefined +declare function wdm( + compiler: Compiler | MultiCompiler, + options?: Options | undefined ): API; declare namespace wdm { - export { - Schema, - Compiler, - MultiCompiler, - Configuration, - Stats, - MultiStats, - ExtendedServerResponse, - IncomingMessage, - ServerResponse, - NextFunction, - WatchOptions, - Watching, - MultiWatching, - OutputFileSystem, - Logger, - Callback, - Context, - Headers, - Options, - Middleware, - GetFilenameFromUrl, - WaitUntilValid, - Invalidate, - Close, - AdditionalMethods, - API, - }; + export { + Schema, + Compiler, + MultiCompiler, + Configuration, + Stats, + MultiStats, + ExtendedServerResponse, + IncomingMessage, + ServerResponse, + NextFunction, + WatchOptions, + Watching, + MultiWatching, + OutputFileSystem, + Logger, + Callback, + Context, + Headers, + Options, + Middleware, + GetFilenameFromUrl, + WaitUntilValid, + Invalidate, + Close, + AdditionalMethods, + API, + }; } -type ServerResponse = import("http").ServerResponse & ExtendedServerResponse; -type Compiler = import("webpack").Compiler; -type MultiCompiler = import("webpack").MultiCompiler; -type Options< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - mimeTypes?: - | { - [key: string]: string; - } - | undefined; - writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; - methods?: string | undefined; - headers?: Headers; - publicPath?: NonNullable["publicPath"]; - stats?: Configuration["stats"]; - serverSideRender?: boolean | undefined; - outputFileSystem?: OutputFileSystem | undefined; - index?: string | boolean | undefined; +type ServerResponse = import('http').ServerResponse & ExtendedServerResponse; +type Compiler = import('webpack').Compiler; +type MultiCompiler = import('webpack').MultiCompiler; +type Options = { + mimeTypes?: + | { + [key: string]: string; + } + | undefined; + writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; + methods?: string | undefined; + headers?: Headers; + publicPath?: NonNullable['publicPath']; + stats?: Configuration['stats']; + serverSideRender?: boolean | undefined; + outputFileSystem?: OutputFileSystem | undefined; + index?: string | boolean | undefined; + historyApiFallback?: boolean; }; -type API< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = Middleware & - AdditionalMethods; -type Schema = import("schema-utils/declarations/validate").Schema; -type Configuration = import("webpack").Configuration; -type Stats = import("webpack").Stats; -type MultiStats = import("webpack").MultiStats; +type API = Middleware< + RequestInternal, + ResponseInternal +> & + AdditionalMethods; +type Schema = import('schema-utils/declarations/validate').Schema; +type Configuration = import('webpack').Configuration; +type Stats = import('webpack').Stats; +type MultiStats = import('webpack').MultiStats; type ExtendedServerResponse = { - locals?: - | { - webpack?: - | { - devMiddleware?: - | Context - | undefined; - } - | undefined; - } - | undefined; + locals?: + | { + webpack?: + | { + devMiddleware?: Context | undefined; + } + | undefined; + } + | undefined; }; -type IncomingMessage = import("http").IncomingMessage; +type IncomingMessage = import('http').IncomingMessage; type NextFunction = (err?: any) => void; -type WatchOptions = NonNullable; -type Watching = Compiler["watching"]; -type MultiWatching = ReturnType; -type OutputFileSystem = Compiler["outputFileSystem"] & { - createReadStream?: typeof import("fs").createReadStream; - statSync?: import("fs").StatSyncFn; - lstat?: typeof import("fs").lstat; - readFileSync?: typeof import("fs").readFileSync; +type WatchOptions = NonNullable; +type Watching = Compiler['watching']; +type MultiWatching = ReturnType; +type OutputFileSystem = Compiler['outputFileSystem'] & { + createReadStream?: typeof import('fs').createReadStream; + statSync?: import('fs').StatSyncFn; + lstat?: typeof import('fs').lstat; + existsSync?: typeof import('fs').existsSync; + readFileSync?: typeof import('fs').readFileSync; }; -type Logger = ReturnType; -type Callback = ( - stats?: import("webpack").Stats | import("webpack").MultiStats | undefined -) => any; -type Context< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - state: boolean; - stats: Stats | MultiStats | undefined; - callbacks: Callback[]; - options: Options; - compiler: Compiler | MultiCompiler; - watching: Watching | MultiWatching; - logger: Logger; - outputFileSystem: OutputFileSystem; +type Logger = ReturnType; +type Callback = (stats?: import('webpack').Stats | import('webpack').MultiStats | undefined) => any; +type Context = { + state: boolean; + stats: Stats | MultiStats | undefined; + callbacks: Callback[]; + options: Options; + compiler: Compiler | MultiCompiler; + watching: Watching | MultiWatching; + logger: Logger; + outputFileSystem: OutputFileSystem; }; -type Headers< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = - | Record - | { - key: string; - value: number | string; - }[] - | (( - req: RequestInternal, - res: ResponseInternal, - context: Context - ) => void | undefined | Record) - | undefined; -type Middleware< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = ( - req: RequestInternal, - res: ResponseInternal, - next: NextFunction +type Headers = + | Record + | { + key: string; + value: number | string; + }[] + | (( + req: RequestInternal, + res: ResponseInternal, + context: Context + ) => void | undefined | Record) + | undefined; +type Middleware = ( + req: RequestInternal, + res: ResponseInternal, + next: NextFunction ) => Promise; type GetFilenameFromUrl = (url: string) => string | undefined; type WaitUntilValid = (callback: Callback) => any; type Invalidate = (callback: Callback) => any; type Close = (callback: (err: Error | null | undefined) => void) => any; -type AdditionalMethods< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - getFilenameFromUrl: GetFilenameFromUrl; - waitUntilValid: WaitUntilValid; - invalidate: Invalidate; - close: Close; - context: Context; +type AdditionalMethods = { + getFilenameFromUrl: GetFilenameFromUrl; + waitUntilValid: WaitUntilValid; + invalidate: Invalidate; + close: Close; + context: Context; };