简体   繁体   English

VSCode 中的 typescript 扩展

[英]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-nativeeslint-plugin-react添加到您的开发依赖项中,并在.eslintrc.js (eslint 配置文件)中添加到module.exports

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 VSCode 扩展中检测 TypeScript 初始化时间? - How to instrument TypeScript initialization time in a VSCode extension? VSCode 扩展:自定义编辑器 Webview 都在 typescript - VSCode extension: Custom Editor with Webview both on typescript 在vscode扩展中使用来自javascript的Typescript泛型 - use typescript generics from vanilla javascript in vscode extension 是否有 VSCode 扩展添加快速修复以将显式类型添加到 Typescript 的字段? - Is there a VSCode extension that adds a Quick Fix for adding the explicit type to a field for Typescript? React/Typescript /VScode - 导入路径不能以“.tsx”扩展名结尾 - React/Typescript /VScode - an import path cannot end with a '.tsx' extension vscode:创建在自定义文件上运行 typescript 的语言服务扩展 - Vscode: create a language service extension that runs typescript on custom files 如何生成 vscode TypeScript 扩展覆盖率报告 - How do a generate vscode TypeScript extension coverage report 为 vscode 扩展开发设置 svelte 和 typescript “watch”脚本 - Setup svelte and typescript “watch” script for vscode extension development 如何从 git 存储库的本地克隆运行打字稿 vscode 扩展? - How do I run a typescript vscode extension from a local clone of the git repository? 在 Vue 2 / Nuxt / Typescript / @nuxtjs-composition-api 项目中使用 VSCode Volar 扩展 - Use of VSCode Volar extension for a Vue 2 / Nuxt / Typescript / @nuxtjs-composition-api project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM