Extend/override metadata of parent classes.
npm install extend-metadata
@Extend()
- class decorator. Use it to extend all parent classes metadata.
@Override()
- property/method decorator. Use it to extend particular metadata.
@AddClassMetadata()
class Animal {
@AddPropertyMetadata()
property: Type;
@AddMethodMetadata()
method(): Type {}
}
@Extend()
class Cat extends Animal { // has the same metadata
property: Type; // also has the same metadata
@AddAnotherMethodMetadata()
method(): Type { // has another metadata
return super.method();
}
}
@AddClassMetadata()
class Animal {
@AddPropertyMetadata()
property: Type;
@AddMethodMetadata()
method(): Type {}
}
class Cat extends Animal { // doesn't have metadata from Animal
@Override()
property: Type; // has the same metadata
method(): Type { // no metadata
return super.method();
}
}
reflect-metadata: ^0.1.13
extend-metadata is MIT licensed.