gmostert / ng2-breadcrumb

This is an angular 2 component that creates a breadcrumb trail. It hooks into the angular2/router, to dynamically build up the crumb trail once a component is routed to.
MIT License
102 stars 80 forks source link

Property 'includes' does not exist on type 'string[]' #31

Closed ZeeAzmat-punch closed 7 years ago

ZeeAzmat-punch commented 7 years ago

breadcrumbService.ts:90:29 breadcrumbService.ts:99:34 breadcrumbService.ts:108:35

"@angular/common": "^2.0.2",
"@angular/compiler": "^2.0.2",
"@angular/core": "^2.0.2",
"@angular/forms": "^2.0.2",
"@angular/http": "^2.0.2",
"@angular/material": "^2.0.0-alpha.9-3",
"@angular/platform-browser": "^2.0.2",
"@angular/platform-browser-dynamic": "^2.0.2",
"@angular/router": "3.0.1",

Getting this error in breadcrumbservice.ts when installed ng-breadcrumb, help would be appreciated.

bbrink68 commented 7 years ago

You need to set tsconfig.json compilerOptions.lib from "es6" to "es7". At least that is how I resolved this.

DennisHoy commented 7 years ago

It works if we could have line 10 and 11 in ng2-breadcrumb/app/components/breadcrumbService.ts changed from: private hideRoutes: Array = new Array(); private hideRoutesRegex: Array = new Array(); to: private hideRoutes: any = new Array(); private hideRoutesRegex: any = new Array();

GopiAnnan commented 7 years ago

As @bbrink68 mentioned, I have resolved by updating tsconfig.json with following lines. "lib": [ "dom", "es7" ], [Reference Url] (https://github.com/AngularClass/angular2-webpack-starter/issues/931)

gmostert commented 7 years ago

I implemented @DennisHoy suggestion. Hope this does the trick as it should really not be necessary to compile against es7, I myself use es5.