Closed
Description
Right now, when we emit meta data of one property that is defined as:
class A {
@Property()
p1: 's1' | 's2';
}
We emit the metadata as:
__metadata("design:type", String)
So, whoever is using this metadata cannot know the literal types of p1
. A library author has to decorate the literal types s1
and s2
in order to access these literal types:
class A {
@Property(strings: ['s1', 's2'])
p1: 's1' | 's2';
}
Why don't we just emit it as an array instead?
__metadata("design:type", ['union', 's1', 's2'])
Related to:
#12703