Option ‘importsNotUsedAsValues‘ has been removed. Please remove it from your configuration

vue3+ts+vite项目,,tsconfig.json文件老是爆红,导致类型校验一直失败

// tsconfig.json
{
	"extends": "@vue/tsconfig/tsconfig.web.json",
	"include": [
		"types/*.d.ts",
		"src/**/*",
		"src/**/*.vue",
		"src/**/*.ts",
		"src/**/*.d.ts"
	],
	"compilerOptions": {
		"target": "esnext",
		"module": "esnext",
		"strict": true,
		"jsx": "preserve",
		"moduleResolution": "node",
		"esModuleInterop": true,
		"allowSyntheticDefaultImports": true,
		"resolveJsonModule": true,
		"ignoreDeprecations": "5.0",
		"verbatimModuleSyntax": true,
		"experimentalDecorators": true,
		"preserveValueImports": false,
		"useDefineForClassFields": true,
		"baseUrl": "./",
		"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
		"paths": {
			"@/*": ["./src/*", "src/types/*"]
		},
		"types": ["element-plus", "node", "nprogress"]
	},
	"references": [
		{
			"path": "./tsconfig.node.json"
		}
	]
}

 查了好多,有的说加上 "ignoreDeprecations": "5.0","verbatimModuleSyntax": true,就可以了,后来经过尝试,按照下面方法可以消除警告,通过校验

 "importsNotUsedAsValues": "remove",

    "ignoreDeprecations": "5.0",

    "verbatimModuleSyntax": true,

 下面是完整的tsconfig.json文件

{
	"extends": "@vue/tsconfig/tsconfig.web.json",
	"include": [
		"types/*.d.ts",
		"src/**/*",
		"src/**/*.vue",
		"src/**/*.ts",
		"src/**/*.d.ts"
	],
	"compilerOptions": {
		"target": "esnext",
		"module": "esnext",
		"strict": true,
		"jsx": "preserve",
		"moduleResolution": "node",
		"esModuleInterop": true,
		"allowSyntheticDefaultImports": true,
		"resolveJsonModule": true,
		"importsNotUsedAsValues": "remove",
		"ignoreDeprecations": "5.0",
		"verbatimModuleSyntax": true,
		"experimentalDecorators": true,
		"preserveValueImports": false,
		"useDefineForClassFields": true,
		"baseUrl": "./",
		"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
		"paths": {
			"@/*": ["./src/*", "src/types/*"]
		},
		"types": ["element-plus", "node", "nprogress"]
	},
	"references": [
		{
			"path": "./tsconfig.node.json"
		}
	]
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值