Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit metadata with union constituents #19154

Closed
tinganho opened this issue Oct 13, 2017 · 2 comments
Closed

Emit metadata with union constituents #19154

tinganho opened this issue Oct 13, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@tinganho
Copy link
Contributor

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

@mhegazy
Copy link
Contributor

mhegazy commented Oct 14, 2017

The metadata provided are not meant to be a reflective runtime type system. you can find more discussion about this in #3060 and #3628

@mhegazy mhegazy added the Duplicate An existing issue was already created label Oct 14, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Oct 30, 2017

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@mhegazy mhegazy closed this as completed Oct 30, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants