Ben Taliadoros
Ben Taliadoros

Reputation: 9461

ng test fails on typescript compilation of es6

When I run ng test on my project I get the following error:

ERROR in src/app/components/some.component.ts(177,38): 
error TS2461: Type 'Set<{}>' is not an array type.

I presume I have to tell typescript I'm using es6, or the angular-cli... any idea which/how?

I have in my tsconfig.json

  "target": "es6",
    "lib": [
      "es2016",
      "dom"
    ]

Using "typescript": "^2.4.2" "@angular/cli": "^1.4.9", and angular 5

Upvotes: 0

Views: 292

Answers (1)

Ben Taliadoros
Ben Taliadoros

Reputation: 9461

Seems to be a typescript bug, I had to convert the set to an array then use the spread operator implicitly:

[...Array.from(new Set(someArray))];

Upvotes: 1

Related Questions