extend-metadata
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

extend-metadata

Travis Coverage Status node npm

GitHub top language GitHub code size in bytes David David

license GitHub last commit semantic-release

Description

Extend/override metadata of parent classes.

Installation

npm install extend-metadata

API

@Extend() - class decorator. Use it to extend all parent classes metadata.

@Override() - property/method decorator. Use it to extend particular metadata.

Usage

Extend

@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();
    }
}

Override

@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();
    }
}

Requirements

reflect-metadata: ^0.1.13

License

extend-metadata is MIT licensed.

Dependencies (0)

    Dev Dependencies (14)

    Package Sidebar

    Install

    npm i extend-metadata

    Weekly Downloads

    0

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    11.9 kB

    Total Files

    14

    Last publish

    Collaborators

    • velmisov