diff --git a/webpack/webpack-env-tests.ts b/webpack/webpack-env-tests.ts index 25ec177d69..f219a3e740 100644 --- a/webpack/webpack-env-tests.ts +++ b/webpack/webpack-env-tests.ts @@ -37,6 +37,44 @@ if(module.hot) { }); } +class ModuleData { + updated: boolean; +} + +if (module.hot) { + module.hot.accept((err: Error) => { + //... + }); + + module.hot.decline("./someModule"); + + module.hot.dispose((data: ModuleData) => { + data.updated = true; + // ... + }); + + let disposeHandler: ((data: ModuleData) => void) = data => { + // ... + }; + module.hot.addDisposeHandler(disposeHandler); + module.hot.removeDisposeHandler(disposeHandler); + + module.hot.check(true, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + module.hot.apply({ ignoreUnaccepted: true }, (err: Error, outdatedModules: (string|number)[]) => { + // ... + }); + + var status: string = module.hot.status(); + let statusHandler: ((status: string) => void) = status => { + // ... + }; + module.hot.status(statusHandler); + module.hot.addStatusHandler(statusHandler); + module.hot.removeStatusHandler(statusHandler); +} + -var status: string = module.hot.status(); diff --git a/webpack/webpack-env.d.ts b/webpack/webpack-env.d.ts index 72022c16e4..04580949b4 100644 --- a/webpack/webpack-env.d.ts +++ b/webpack/webpack-env.d.ts @@ -172,11 +172,11 @@ declare namespace __WebpackModuleApi { /** * If true the update process continues even if some modules are not accepted (and would bubble to the entry point). */ - ignoreUnaccepted: boolean; + ignoreUnaccepted?: boolean; /** * Indicates that apply() is automatically called by check function */ - autoApply: boolean; + autoApply?: boolean; } }