• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

476
Views
configure vscode react native auto-imports without ts errors

I'm working on a React Native project using Javascript.

I want vscode to display the quick fix imports suggestion like this one:

enter image description here

The problem is that it also displays typescript errors, like this one:

enter image description here

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!

almost 3 years ago · Juan Pablo Isaza
2 answers
Answer question

0

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.

almost 3 years ago · Juan Pablo Isaza Report

0

The best way is to create jsconfig.json and type in:

{
  "compilerOptions": {
    "module": "CommonJS",
    "jsx": "preserve",
    "checkJs": true
  },
  "exclude": ["node_modules", "**/node_modules/*"]
}

almost 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error