加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – 在’string []’类型中不存在属性’includes’

发布时间:2020-12-17 08:46:42 所属栏目:安全 来源:网络整理
导读:得到错误 Property ‘includes’ does not exist on type ‘string[]’ 在node_modules / ng2-breadcrumb / app / components / breadcrumbService.ts中 我正在尝试在angular2应用程序中实现面包屑功能. 将“ES2017”添加到tsconfig.json中的“lib”数组中:
得到错误

Property ‘includes’ does not exist on type ‘string[]’

在node_modules / ng2-breadcrumb / app / components / breadcrumbService.ts中
我正在尝试在angular2应用程序中实现面包屑功能.

将“ES2017”添加到tsconfig.json中的“lib”数组中:
{
  "compilerOptions": {
    ...
    "lib": ["es6","dom","es2017"],...
    "target": "es5",...
  }
}

这应该适用于TypeScript 2.1.

一个related issue.

说明

自ES7(ES2016)以来,支持阵列上的includes方法.以上将添加一个缺少的库文件进行编译.

TypeScript编译器选项记录在here中.

Lib es2016或es7可能足够代替es2017(未经测试).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读