问题
In VS Code, when I import jquery using import $ from 'jquery';
, Intellisense isn't working. This is what I get:
However, when using the require syntax, const $ = require('jquery');
, Intellisense does work:
This happens with any kinds of import, not only with jquery.
Any way to make Intellisense work when using the import syntax? I am using typings.
回答1:
This is know bug. https://github.com/Microsoft/vscode-react-native/issues/61
Fix is already available in Insiders build. Or you can wait for the stable version 1.0, which will be released in few days.
回答2:
Starting from version 1 (released April 14th 2016), you need a jsconfig.json
file at the root of your project with the following content in order to enable Intellisense with the import
syntax:
"compilerOptions": {
"target": "ES6",
"allowSyntheticDefaultImports": true
}
来源:https://stackoverflow.com/questions/36561203/why-do-i-get-intellisense-in-vscode-when-using-require-but-not-when-using-imp