You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide more detailed metadata for decorators #12577
#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.
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.
Activity
joesonw commentedon Jan 3, 2017
Would this be accepted as a feature? If so, I can submit a PR for this.
mhegazy commentedon 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.