我的 TS 运行时出现错误,我想忽略这些错误,进行编译,但是在使用时
/* tslint:disable */
运行我的构建时它仍然运行。
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>"
]
}
}
或者将您的文件添加到 .eslintignore
(如果您有的话)。
关于javascript - 禁用单个文件的 TypeScript Inline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64663635/