首页 > 解决方案 > 在 Typscript 中,如何将其设置为 ECMAScript 5?

问题描述

我正在尝试编译一些打字稿代码,并得到这个编译器错误:

 Accessors are only available when targeting ECMAScript 5 and higher.

我以为我已经通过在 tsconfig.json 文件中设置目标来做到这一点:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true, 
    "esModuleInterop": true
    }
}

标签: typescript

解决方案


推荐阅读