Instead of:
const set = new Set(['foo', 'bar', 'baz', 'foo']); // Set(3) { 'foo', 'bar', 'baz' }
const result = [...set] // []
Do:
const set = new Set(['foo', 'bar', 'baz', 'foo']); // Set(3) { 'foo', 'bar', 'baz' }
const result = Array.from(set) // ['foo', 'bar', 'baz']