相关疑难解决方法(0)

TS1086:不能在环境上下文中声明访问器

当角运行,我得到thje错误TS1086: An accessor cannot be declared in an ambient context.的JavaScript getter和setter在这个抽象类打字稿

这是来源:


  /**
   * The current id key for the EStore instance.
   * @return this.config.idKey;
   */
  get ID_KEY(): string {
    return this.config.idKey
  }
  /**
   * The current guid key for the EStore instance.
   * @return this.config.guidKey;
   */
  get GUID_KEY(): string {
    return this.config.guidKey
  }
Run Code Online (Sandbox Code Playgroud)

在最新版本的 Angular 之前,这一直运行良好。我们不再允许在抽象类中使用 getter 和 setter 吗?

javascript typescript angular

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

javascript ×1

typescript ×1