microsoft/TypeScript

Emit serialized design-time type metadata for decorators

rbuckton opened this issue · 0 comments

Add support behind an experimental compiler option to emit design-type metadata for decorated declarations in source.

  • Add __metadata helper that depends on a polyfill for a proposed Reflect.metadata decorator.
  • Emit calls to __metadata for class and member (property and method) decorators
  • For a class declaration, emit the type metadata for constructor parameters of the constructor with a body.
  • For a method declaration, emit the type metadata for the member, its parameters, and its return type.
  • For an accessor or property declaration, emit the type metadata for the member.
  • Add compiler option to enable experimental metadata support.

A few notes on metadata:

  • Type metadata uses the metadata key "design:type".
  • Parameter type metadata uses the metadata key "design:paramtypes".
  • Return type metadata uses the metadata key "design:returntype".