Open
Description
I was trying to use a Set
, which should be supported according to readme. Minimal example:
class Person {
@Type(() => Number)
public numbers: Set<number> = new Set()
}
const person = new Person()
person.numbers = new Set([1,2,3,4,5])
const plain = instanceToPlain(person)
const instance = plainToInstance(Person, plain)
console.log(person)
console.log(plain)
console.log(instance)
The problem:
Actual output:
Person { numbers: Set { 1, 2, 3, 4, 5 } }
{ numbers: [ 1, 2, 3, 4, 5 ] }
Person { numbers: [ 1, 2, 3, 4, 5 ] }
Expected output:
Person { numbers: Set { 1, 2, 3, 4, 5 } }
{ numbers: [ 1, 2, 3, 4, 5 ] }
Person { numbers: Set { 1, 2, 3, 4, 5 } }
How do I use it correctly?