Skip to content

Provide more detailed metadata for decorators #12577

Closed
@joesonw

Description

@joesonw

#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions