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

Provide more detailed metadata for decorators #12577

Closed
joesonw opened this issue Nov 30, 2016 · 2 comments
Closed

Provide more detailed metadata for decorators #12577

joesonw opened this issue Nov 30, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@joesonw
Copy link

joesonw commented Nov 30, 2016

#Proposal
Current emitted decorator metadata, only contains minimal typing information. My suggestion is to provide detailed information. Such as, nested type (generic type).

Example

1. resolve nested typing.

class A {
    @Foo
    propA: Map<string, Promise<number>>;
    @Bar
    propA: Map<string, Map<List<number>, boolean>>;
    @Baz
    methodA(): Map<Promise<number>, string>;
}

both @Foo's deisng:type and @Foo's design:returntype and each design:paramtypes should be the same.

resulting metadata:

@Foo: [Map, [string, [Promise, [number] ] ] ];
@Bar: [Map, [string, [Map, [ [List, [number] ] , boolean] ] ];
@Baz: [Map, [ [Promise, [number] ] , string] ];

logic:
for any generic type.
Type<...Arguments> -> [Type, [...Arguments]], recursively.

2. Retrieve parameter names

new metadata design:paramnames, in the same order of design:paramtypes.

3. ParamTypes and ParamNames for class decorators

@Foo
class A {
	propA: string;
	methodA(): number;
}

similar to deisng:paramtypes and design:paramnames of a method decorator. It retrieves paramter types and paramnames of each property and function even props were not assigned with a initial value. param type for a method should be Function in this case.

@joesonw
Copy link
Author

joesonw commented Jan 3, 2017

Would this be accepted as a feature? If so, I can submit a PR for this.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2017

Duplicate of #11362

As noted in #14971 (comment), reflection and runtime type serialization is outside the scope of the TypeScript project in the time being.

Relevant discussion in #3628.

@mhegazy mhegazy closed this as completed Apr 27, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label Apr 27, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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