Reputation: 1327
TypeScript seems to not correctly support array literals spread operator.
Array.from example worked
const uniq1 = (list: Iterable<any>): Array<any> => Array.from(new Set<any>(list))
Array spread example broken
const uniq2 = (list: Iterable<any>): Array<any> => [...new Set<any>(list)]
The second example return the following error: Type 'Set' is not an array type.
Upvotes: 2
Views: 513
Reputation: 1494
This is a missing feature. Spreads ...
aren't fully implemented yet.
Upvotes: 0
Reputation: 2251
TypeScript doesn't support spread operator now, but it will change in future:
https://github.com/Microsoft/TypeScript/wiki/Roadmap#21
Upvotes: 2