Automatically add namespace imports ("import * as foo from …") in JavaScript
已回答
In some JavaScript/TypeScript projects, I sometimes have to import a whole module (e.g. to pass it to jest.spyOn()). This is called a namespace import. Is it possible to have IntelliJ IDEA automatically insert such an import after writing the module's name? E.g. here I'd like IntelliJ to suggest adding import * as utils from "./utils.ts":

In a Python project, such module imports are suggested both by the completions and intention actions pop-ups:

请先登录再写评论。
Unfortunately, it’s not possible at the moment. Please feel free to create a new feature request here: https://youtrack.jetbrains.com/issues/WEB. We’ll see if it can be implemented.
Here is a feature request bthat looks related: WEB-77056.
As a workaround, you can use the
importnslive template to add such imports.