简体   繁体   中英

typescript extension in VSCode

I just created a sample react-native project with the following command.

react-native init SampleProject --template typescript

Then I got the red line of Editor. How to fix this?

I guess this concerns with extension. What extension should I install for typescript in react-native?

在此处输入图像描述

This is the image that I hover mouse on tag. 在此处输入图像描述

I did the following and it worked for me.

yarn add --dev @types/react-native

I recommend using ESLint

Last year TSLint was deprecated in favor of ESLint (TSLint in 2019). TSLint was a valuable project for the TypeScript community and the efforts there were greatly appreciated. The migration from TSLint to ESLint is welcome in being able to leverage more of what the larger JavaScript community has been developing

In addition you should add eslint-plugin-react-native and eslint-plugin-react to your dev dependencies and inside .eslintrc.js (eslint config file) add to the module.exports

plugins: ['react', 'react-native']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM