简体   繁体   English

typescript 中的“对象关键字未定义”错误

[英]“Object keyword is not defined” error in typescript

I have the following code in typescript:我在 typescript 中有以下代码:

 const a = (b: object) => { console.log(b) } a({c:2})

Executing the above code I get: ESLint: 'object' is not defined.(no-undef) .执行上面的代码我得到: ESLint: 'object' is not defined.(no-undef) Why am I getting this error and how to solve it?为什么我会收到此错误以及如何解决?

After setting this in eslintConfig file:在 eslintConfig 文件中设置后:

 "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"

... all works. ...一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM