我收到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)
},发布于 2020-06-20 00:13:12
尝试在window对象上访问它,比如window.Object。
const objectParamsAllNumbers = (obj: Object) =>
!window.Object.values(obj).find(elem => {
return window.isNaN(elem);
});https://stackoverflow.com/questions/62474258
复制相似问题