Javascript 禁用单个文件的TypeScript内联
我有TS运行时出现的错误,我想忽略、编译,但在使用Javascript 禁用单个文件的TypeScript内联,javascript,typescript,Javascript,Typescript,我有TS运行时出现的错误,我想忽略、编译,但在使用 /*tslint:禁用*/ 它在运行我的构建时仍然运行 hutber@hutber:/var/www/bp/frontend$ git commit -m"feat: add basic foundations for theme & breadcrums" husky > pre-commit (node v14.14.0) $ tsc components/Layouts/Breadcrums/index.
/*tslint:禁用*/
它在运行我的构建时仍然运行
hutber@hutber:/var/www/bp/frontend$ git commit -m"feat: add basic foundations for theme & breadcrums"
husky > pre-commit (node v14.14.0)
$ tsc
components/Layouts/Breadcrums/index.tsx:17:13 - error TS2322: Type 'string' is not assignable to type 'HTMLCollection'.
17 {a}
~~~
在
tslint.json
中,您可以尝试排除该文件:
{
"extends": "tslint:latest",
"linterOptions": {
"exclude": [
"bin",
"<path to your excluded file here>"
]
}
}
{
“扩展”:“tslint:latest”,
“过梁选项”:{
“排除”:[
“垃圾桶”,
""
]
}
}
或者将您的文件添加到
.eslintignore
,如果您有此选项的话。我认为TSLint已被弃用,您需要使用,例如//eslint disable next line@typescript eslint/
。但是,我不完全了解您的配置,因此可能需要对其进行微调。能否显示代码?似乎您正在尝试将字符串分配给HTMLCollection。不完整/布局/Breadcrums/index.tsx:17:13我想指出正确的拼写是Breadcrumbs
,仅供参考。你是想禁用tslint(linter规则)还是tsc(类型检查)?@HasipTimurtas当然,我会更新这个问题。然而,我不是在寻找TS方面的修复方法,我只是想知道如何关闭一个文件的TS。啊@Bergi我想你已经解决了这个问题。我正试图关闭TSC:D谢谢你,但我想在线完成。