diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index fe3dc638e1..d540a165c4 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1131,8 +1131,8 @@ declare namespace webpack { abstract class Stats { compilation: compilation.Compilation; hash?: string; - startTime?: Date; - endTime?: Date; + startTime?: number; + endTime?: number; /** Returns true if there were errors while compiling. */ hasErrors(): boolean; /** Returns true if there were warnings while compiling. */ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index 487d28b8f6..6c8bd52ba7 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -895,3 +895,11 @@ profiling = new webpack.debug.ProfilingPlugin({ outputPath: './path.json' }); configuration = { plugins: [profiling] }; + +compiler.hooks.done.tap('foo', stats => { + if (stats.startTime === undefined || stats.endTime === undefined) { + throw new Error('Well, this is odd'); + } + + console.log(`Compiled in ${stats.endTime - stats.startTime}ms`); +});