I'm working on a React Native
project using Javascript
.
I want vscode to display the quick fix imports suggestion like this one:
The problem is that it also displays typescript
errors, like this one:
Here is my jsconfig.json
file:
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"checkJs": true,
"jsx": "react-native"
},
"exclude": ["node_modules"],
"include": ["src/**/*"]
}
I've realised that if I comment out "checkJs": true,
the errors are gone but then the import suggestions doesn't appear anymore.
Here my settings.json
:
{
"workbench.iconTheme": "material-icon-theme",
"editor.fontFamily": "JetBrains Mono",
"editor.fontLigatures": true,
"editor.fontSize": 13,
"editor.formatOnSave": true,
"git.autofetch": true,
"git.confirmSync": false,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"terminal.external.osxExec": "iTerm.app",
"typescript.validate.enable": false,
"javascript.suggestionActions.enabled": true,
}
I've already read many posts and played around disabling typescript
and javascript
validation "typescript.validate.enable": false,
but nothing seems to work.
Any ideas? I'm coming from webstorm so I'm not really used to vscode.
Any help would be really appreciated. Thanks!
I don't understand why you need a config for auto imports, but you could install the Auto import snippet from VSC snippets, here is the link try it.
also, the error from your typescript is not related to the auto import, it is a typescript error, your touchableOpacity still missing some props.
The best way is to create jsconfig.json
and type in:
{
"compilerOptions": {
"module": "CommonJS",
"jsx": "preserve",
"checkJs": true
},
"exclude": ["node_modules", "**/node_modules/*"]
}