JSPM

deprecated-decorator

0.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 542935
  • Score
    100M100P100Q180045F
  • License MIT

A simple decorator for deprecated methods and properties.

Package Exports

  • deprecated-decorator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deprecated-decorator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM Package Build Status

Deprecated Decorator

A simple decorator for deprecated properties, methods and classes.

Transpilers supported:

Install

npm install deprecated-decorator --save

API References

export declare type DeprecatedDecorator = ClassDecorator & PropertyDecorator;

export interface DeprecatedOptions {
    alternative?: string;
    version?: string;
    url?: string;
}

export declare function deprecated(options?: DeprecatedOptions): DeprecatedDecorator;
export declare function deprecated(alternative?: string, version?: string, url?: string): DeprecatedDecorator;

export default deprecated;

Usage

Decorating a class will enable warning on constructor and static methods (including static getters and setters):

import deprecated from 'deprecated-decorator';

// alternative, since version, url
@deprecated('Bar', '0.1.0', 'http://vane.life/')
class Foo {
    static method() { }
}

Or you can decorate methods respectively:

import deprecated from 'deprecated-decorator';

class Foo {
    @deprecated('otherMethod')
    method() { }
    
    @deprecated({
        alternative: 'otherProperty',
        version: '0.1.2',
        url: 'http://vane.life/'
    })
    get property() { }
}

License

MIT License.