TS 错误:es2015,类型 'Array<any> | undefined[]' 必须有一个返回迭代器的 '[Symbol.iterator]()' 方法

问题描述

当我从 es2015 更改 tsConfig.json target: es5 时。我开始收到构建错误

错误 TS2488:输入“数组” undefined[]' 必须有一个返回迭代器的 'Symbol.iterator' 方法

 this.navItems = [
      ...(this.authService.hasHomePageAccess() ? { displayName: 'Home',iconName: '',route: 'home' } : []),...(this.authService.hasAboutPageAccess() ? { displayName: 'About',route: 'about' } : []),...(this.authService.hasReportsPageAccess() ? { displayName: 'Dashbaord',route: 'dashbaord' } : []),];

任何建议都会很棒!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)