Using spread syntax and new Set() with typescript Using spread syntax and new Set() with typescript typescript typescript

Using spread syntax and new Set() with typescript


Update: With Typescript 2.3, you can now add "downlevelIteration": true to your tsconfig, and this will work while targeting ES5.

The downside of downlevelIteration is that TS will have to inject quite a bit of boilerplate when transpiling. The single line from the question transpiles with 21 lines of added boilerplate: (as of Typescript 2.6.1)