eslint error: 'Uint32Array' is not defined. no-undef

eslint error: 'Uint32Array' is not defined. no-undef

在 TypeScript 和 eslint 中使用 Uint32Array 时,我遇到了这个错误。

34:43 error 'Uint32Array' is not defined   no-undef

我该如何解决这个问题?

我的 eslintrc 看起来像这样(使用 YAML 语法):

env:
  browser: true
  jasmine: true
  jest:

您需要将 "es6": true 添加到您的 .eslintrc 文件中。这告诉 eslint 使用浏览器 JS 引擎提供的 "builtin" 全局变量。