From 128496570a7a3db1be008f0cede4d180ea045085 Mon Sep 17 00:00:00 2001 From: Ryan Lamansky <42445152+RyanLamanskyInsite@users.noreply.github.com> Date: Wed, 10 Jul 2019 15:49:00 -0500 Subject: [PATCH] Added the `id` property to RequireContext as described here: https://webpack.js.org/guides/dependency-management/#context-module-api (#36676) --- types/webpack-env/index.d.ts | 4 +++- types/webpack-env/webpack-env-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 3677523927..01ef65fc18 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack (module API) 1.13 +// Type definitions for webpack (module API) 1.14 // Project: https://github.com/webpack/webpack // Definitions by: use-strict // rhonsby @@ -15,6 +15,8 @@ declare namespace __WebpackModuleApi { (id: string): any; (id: string): T; resolve(id: string): string; + /** The module id of the context module. This may be useful for module.hot.accept. */ + id: string; } interface RequireFunction { diff --git a/types/webpack-env/webpack-env-tests.ts b/types/webpack-env/webpack-env-tests.ts index b07a3b632a..1907416c61 100644 --- a/types/webpack-env/webpack-env-tests.ts +++ b/types/webpack-env/webpack-env-tests.ts @@ -13,6 +13,8 @@ otherModule.otherMethod(); let context = require.context('./somePath', true); let contextModule = context('./someModule'); +const contextId: string = require.context('./somePath').id; + require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => { });