Skip to content
On this page

Working with Set<T>

With the intention of being idiomatic, ts-dax's API returns a Set<T> instead of an Array<T> where possible (and suitable).

Converting arrays to sets

Arrays can be easily converted to sets by supplying them to the Set constructor:

ts
const arr = [...] // Your array object
const set = new Set(arr)

Converting sets to arrays

Using Array.from(), you can easily create a Set<T> from a provided Array<T>.

ts
const set = ... // Your set object (possibly generated by ts-dax)
const arr = Array.from(set)

Released under the MIT License. Not affiliated with Microsoft.