_From @mohsen1 on January 5, 2017 18:28_
Steps to Reproduce:
var webpack = require('webpack')
/** @type {webpack.Configuration} */
var config = {
module: {
loa // expected autocomplete
}
}
module.exports = config;
loaders.
_Copied from original issue: Microsoft/vscode#18184_
Looks like a TS issue, unrelated to webpack and imports. Tested with 2.1.5 and 2.2.0-dev.20170106
Here's a simpler repo:
interface IFoo {
bar: number
}
/** @type {IFoo} */
const foo = {
}
When typing inside of foo, we do not get a completion item for bar. If the code is changed to
interface IFoo {
bar: number
}
const foo: IFoo = {
}
then bar is returned as a completion inside of foo.
Here's the TSServer communications in the bad case:
[Trace - 2:47:42 PM] Sending request: completions (1960). Response expected: yes. Current queue length: 0
Arguments: {
"file": "/Users/matb/projects/sand/bla.ts",
"line": 7,
"offset": 5
}
[Trace - 2:47:42 PM] Response received: completions (1960). Request took 1 ms. Success: false . Message: No content available.
Ran into similar problem, and just wanted to point out that I have imported types as follows. And this (workaround?) works pretty well in vscode v1.35.0-insider.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const baseUrl = "/";
/** @type {() => import("webpack").Configuration} */
module.exports = () => ({
plugins: [
new HtmlWebpackPlugin({
template: "index.ejs",
metadata: { baseUrl }
})
]
})
Yes the import("webpack").Configuration syntax works now.
This appears to work as expected now using a standard JSDoc comment for the type of the config object. With the following code I get intellisense for its properties:
const webpack = require('webpack');
/** @type {webpack.Configuration} */
module.exports = {
...
};
Screenshot:

Using VS Code 1.45.1.
Most helpful comment
This appears to work as expected now using a standard JSDoc comment for the type of the config object. With the following code I get intellisense for its properties:
Screenshot:
Using VS Code 1.45.1.