英文:
Vue-tsc shows an error badge but reports 0 errors
问题
以下是翻译好的部分:
"After upgrading from NUXT 3 Release candidate to the latest and released version and making the changes I needed in order to get everything running smoothly, vue-tsc has started showing an error-badge just before reporting 0 errors."
从NUXT 3的候选版本升级到最新的正式版本并进行所需的更改以确保一切运行顺畅后,vue-tsc开始显示一个错误标志,然后报告0个错误。
"Do I actually have any errors, or is there something else going on here?"
我实际上是否有任何错误,或者这里还有其他情况?
"Is it vue-tsc logging the badge, or something else?"
是vue-tsc记录了这个标志,还是其他什么原因?
"Versions"
版本信息
- Nuxt: 3.2.2
- vue-tsc: 1.1.5
- typescript: 4.8.3
"Nuxt 3.0.9-rc along with downgrading vue-tsc removes the 'error'."
回退到Nuxt 3.0.9-rc版本并降级vue-tsc会移除这个'错误'。
英文:
After upgrading from NUXT 3 Release candidate to the latest and released version and making the changes I needed in order to get everything running smoothly, vue-tsc has started showing an error-badge just before reporting 0 errors.
Do I actually have any errors, or is there something else going on here?
Is it vue-tsc logging the badge, or something else?
Versions
-
Nuxt: 3.2.2
-
vue-tsc: 1.1.5
-
typescript: 4.8.3
Going back to Nuxt 3.0.9-rc along with downgrading vue-tsc removes the "error".
答案1
得分: 1
我遇到了与Nuxt 3.2.3和vue-tsc 1.2.0相同的问题。但是,只有在开发模式启用类型检查时才会引发此问题。我通过以下方式之一来启用类型检查,可以在nuxt.config.json
中添加如下选项(就像官方Nuxt文档在这里所述的那样https://nuxt.com/docs/guide/concepts/typescript):
typescript: { typeCheck: true }
或者使用vite-plugin-checker和
checker({ vueTsc: true })
添加到vite.plugins
属性中。
在这两种情况下,仍然会出现一个难看的红色错误标记,但没有错误。
我没有找到任何解决方案,所以我只是从nuxt.config.json中删除了这个开发中的检查,并依赖于:
- 我的IDE,它无论如何都会遵循
tsconfig.json
的规则 - 显式的预提交挂钩(在我的情况下是
eslint
和nuxi typecheck
,虽然也可以是vue-tsc --noEmit
)。
这样,我可以确保没有错误进入仓库,而开发人员在编写代码时仍然会收到有关错误的通知。
我知道这不是对你问题的回答(也可能不是最好的解决方案...),但只是想为那些可能能够澄清这个问题的人提供更多背景信息。
英文:
I have the same issue with Nuxt 3.2.3 and vue-tsc 1.2.0. However, it raises only if I enable type check in development mode. I did this either by adding to nuxt.config.json
the following option (like official Nuxt docs state here https://nuxt.com/docs/guide/concepts/typescript):
typescript: { typeCheck: true }
or with vite-plugin-checker and
checker({ vueTsc: true })
for vite.plugins
property.
In both cases an ugly red ERROR badge followed by 0 errors is still there.
I haven't found any solution so I've just removed this in-dev check from nuxt.config.json and rely on:
- my IDE which follows
tsconfig.json
rules anyways - pre-commit hook with explicit linting commands (
eslint
andnuxi typecheck
in my case, though it can bevue-tsc --noEmit
as well).
This way I can be sure no errors go to the repo while developers are still notified about them when writing their code.
I know this isn't an answer to your question (and probably not the best solution...) but just wanted to give more context for those who could probably clarify this one.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论