[英]ESLint no restricted globals with Object.values in TypeScript project
我收到一個no restricted globals
的 ESLint 錯誤:
const objectParamsAllNumbers = (obj: Object) =>
!Object.values(obj).find(elem => {
return isNaN(elem);
});
我嘗試將ES2017.Object
添加到我的tsconfig
但仍然拋出錯誤:
{
"compilerOptions": {
"isolatedModules": true, // Warn you if you write certain code that can’t be correctly interpreted by a single-file transpilation process.
"outDir": "./dist/",
"module": "commonjs",
"target": "ES5",
"jsx": "react",
"lib": ["ESNEXT", "DOM", "DOM.Iterable", "ES5", "ES2017", "ES2017.Object"],
"allowJs": true, // Allow JavaScript files to be imported inside your project, instead of just .ts and .tsx
"checkJs": true, // When checkJs is enabled then errors are reported in JavaScript files. This is the equivalent of including // @ts-check at the top of all JavaScript files which are included in your project.
"allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
"skipLibCheck": true,
"types": ["node", "webpack-env", "@wdio/sync", "mocha", "expect-webdriverio"],
"strict": false // Enables all strict type checking options (This is too restrictive for the current code base)
},
嘗試在 window object 上訪問它,例如window.Object
const objectParamsAllNumbers = (obj: Object) =>
!window.Object.values(obj).find(elem => {
return window.isNaN(elem);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.