DefinitelyTyped/types/koa-webpack/index.d.ts
Remco Haszing 4f2ff6de9d
🤖 Merge PR #47103 Update Koa-webpack to 6.0 and add missing types for koa state by @remcohaszing
* Format koa-webpack types using Prettier

* Add injected Koa state types for koa-webpack

* Bump koa-webpack to version 6.0

This release only updates dependencies and drops support for Node 8.

* Delegate ctx.state.fs from webpack-dev-middleware

* Fix tests
2020-08-31 09:36:40 -04:00

49 lines
1.5 KiB
TypeScript

// Type definitions for koa-webpack 6.0
// Project: https://github.com/shellscape/koa-webpack
// Definitions by: Luka Maljic <https://github.com/malj>
// Lee Benson <https://github.com/leebenson>
// miZyind <https://github.com/miZyind>
// Tomek Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import Koa = require('koa');
import webpack = require('webpack');
import webpackDevMiddleware = require('webpack-dev-middleware');
import webpackHotClient = require('webpack-hot-client');
declare module 'koa' {
interface DefaultState {
fs: webpackDevMiddleware.Options['fs'];
stats: webpack.Stats;
}
}
declare function koaWebpack(
options?: koaWebpack.Options,
): Promise<Koa.Middleware & koaWebpack.CombinedWebpackMiddleware>;
declare namespace koaWebpack {
interface Options {
compiler?: webpack.Compiler;
config?: webpack.Configuration;
devMiddleware?: webpackDevMiddleware.Options;
hotClient?: webpackHotClient.Options | boolean;
}
interface CombinedWebpackMiddleware {
devMiddleware: webpackDevMiddleware.WebpackDevMiddleware;
/**
* @todo make this a `webpack-hot-client@^4.0.0` instance, no typings for v4 available yet
*/
hotClient: {
close: () => void;
options: webpackHotClient.Options;
server: any;
};
close(callback?: () => any): void;
}
}
export = koaWebpack;