Open
Description
I was trying to use the discriminator in @type as per documentation:
@Type(() => Photo, {
discriminator: {
property: '__type',
subTypes: [
{ value: Landscape, name: 'landscape' },
{ value: Portrait, name: 'portrait' },
{ value: UnderWater, name: 'underwater' },
],
},
})
topPhoto: Landscape | Portrait | UnderWater;
But my use case involves to use it in a Map construct like this:
@Type(() => Photo, {
discriminator: {
property: '__type',
subTypes: [
{ value: Landscape, name: 'landscape' },
{ value: Portrait, name: 'portrait' },
{ value: UnderWater, name: 'underwater' },
],
},
})
topPhoto: Map<string, Landscape | Portrait | UnderWater>; <-------my scenario
When testing I found out that the discriminator doesn't work anymore and I cannot find out an workaround...
Can you please help me understand how to use it in order to have sub-types based on a property in a Map construct and not the base class?