Open
Description
Description
I am trying to use class-transformer with maps, and I having an issue using numbers as keys.
Minimal code-snippet showcasing the problem
I defined the following class:
export class Data {
@Type(() => String)
public map: Map<number, string>
constructor(
map: Map<number, string> = new Map<number, string>()
) {
this.map = map
}
}
when I do:
plainToInstance(Data, {map: {123: "test"}}
the key is converted from number to string
Expected behavior
The entry in the map should have 123 as key
Actual behavior
The entry in the map is "123" as key