[英]typescript extension in VSCode
I just created a sample react-native project with the following command.我刚刚使用以下命令创建了一个示例 react-native 项目。
react-native init SampleProject --template typescript
Then I got the red line of Editor.然后我得到了Editor的红线。 How to fix this?
如何解决这个问题?
I guess this concerns with extension.我想这与扩展有关。 What extension should I install for typescript in react-native?
react-native中的typescript应该安装什么扩展?
This is the image that I hover mouse on tag.这是我 hover 鼠标在标签上的图像。
I did the following and it worked for me.我做了以下,它对我有用。
yarn add --dev @types/react-native
I recommend using ESLint我推荐使用 ESLint
Last year TSLint was deprecated in favor of ESLint (TSLint in 2019).
去年,TSLint 被弃用,取而代之的是 ESLint(2019 年的 TSLint)。 TSLint was a valuable project for the TypeScript community and the efforts there were greatly appreciated.
TSLint 是 TypeScript 社区的一个有价值的项目,那里的努力得到了极大的赞赏。 The migration from TSLint to ESLint is welcome in being able to leverage more of what the larger JavaScript community has been developing
欢迎从 TSLint 迁移到 ESLint,因为它能够利用更大的 JavaScript 社区一直在开发的更多内容
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
此外,您应该将
eslint-plugin-react-native
和eslint-plugin-react
添加到您的开发依赖项中,并在.eslintrc.js
(eslint 配置文件)中添加到module.exports
plugins: ['react', 'react-native']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.