Sveltekit的noImplicitAny仍然会反复出现。

huangapple go评论70阅读模式
英文:

Sveltekit noImplicitAny keeps appearing back

问题

我正在使用SvelteKit开发一个非TypeScript项目。
没有严肃的事情,只是为了一些实验和学习的目的。
我决定一次只解决一个问题,之前使用Svelte + JS,决定不使用TypeScript。
我认为我在初始化期间声明了这一点,但在VS Code中遇到了许多"嘿,这里有一个隐式any!"的错误。

所以我(经过一些研究)决定在.svelte-kit/types/tsconfig.json中添加'noImplicitAny': false。

这帮助了一段时间。
过了一段时间(我猜是在构建之后?),这个设置被覆盖了,错误又出现了。

我会感激一些关于这个问题的帮助,需要一些可以一直保持在我身边的解决方案,至少在我开始学习和实施TypeScript之前。

英文:

I'm working on a non-typescript project using SvelteKit.
No serious stuff, just for some experimental and learning purposes. I decided to go for one monster at a time, and formerly using Svelte + JS, decided to not use Typescript. I thought I declared so during initialisation, but got attacked by VS Code with many "hey, there is an implicit any!" errors.
So I (after some research) decided to add 'noImplicitAny': false in .svelte-kit/types/tsconfig.json

And it helped for a while. After some time (I guess after build?) this setting got overridden and errors are back.

I would appreciate some help with that, need some solution that will stay with me, at least until I start learning and implementing TypeScript.

答案1

得分: 1

.svelte-kit 文件夹中的文件不应进行修改,它们都是自动生成的。您可以在项目根目录创建一个 tsconfig.json/jsconfig.json 文件来覆盖设置。

这个文件应该扩展 .svelte-kit 中的文件:

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"noImplicitAny": false,
	}
}
英文:

The files in .svelte-kit should not be modified, they are all auto-generated. You should be able to create a tsconfig.json/jsconfig.json at the root of the project to override the settings.

This file should extend the one in .svelte-kit:

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"noImplicitAny": false,
	},
}

huangapple
  • 本文由 发表于 2023年1月9日 15:28:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75054227.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定