npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@decorize/deprecate

v1.0.0

Published

Decorator to deprecate the class, method, accessor and property

Readme

chat build quality coverage dependencies min+gzip typescript

Decorator to deprecate the class, method, accessor and property.

Install

npm install @decorize/deprecate --save

Usage

Decorate with the message:

import { deprecate } from '@decorize/deprecate';

class Example {
  @deprecate('Here can be string or string[]')
  public property;
}

new Example().property = 'anyText'; // Output deprecation message.

Decorate the property:

import { deprecate } from '@decorize/deprecate';

class Example {
  @deprecate
  public property;
}

new Example().property = 'anyText'; // Output deprecation message.

Decorate the method:

import { deprecate } from '@decorize/deprecate';

class Example {
  @deprecate
  public method(): boolean {
    return this instanceof Example;
  }
}

new Example().method.call(null); // Output deprecation message.

Decorate the accessor:

import { deprecate } from '@decorize/deprecate';

class Example {
  @deprecate
  public get property(): void {
    return;
  }
}

new Example().property; // Output deprecation message.

Decorate the class:

import { deprecate } from '@decorize/deprecate';

@deprecate
class Example {}

new Example(); // Output deprecation message.

Decorate the class with members:

import { deprecate } from '@decorize/deprecate';

@deprecate
class Example {
  public method(): boolean {
    return this instanceof Example;
  }
}

new Example().method.call(null); // Output deprecation message.

Typing

export interface DeprecateConfig {
  setter?: boolean;
  getter?: boolean;
  message?: string | string[];
}

export declare function deprecate<T extends Function>(target: T): T;
export declare function deprecate(message: string | string[]): any;
export declare function deprecate(configuration: DeprecateConfig): any;
export declare function deprecate(target: object, property: PropertyKey): void;
export declare function deprecate(target: object, property: PropertyKey, descriptor: PropertyDescriptor): any;
export declare function deprecate(...args: any[]): any;

Feature

  • Support different naming conventions.
    Available in lowercase @deprecate or capital letter @Deprecate.

  • Support different coding conventions.
    Applicable directly to the declaration @deprecate or as the decorator's factory @deprecate().

  • Allow to configure the deprecation output.
    Configure output message as plain string or array of strings. The decorator cannot be applied to both the getter and setter of the same property, so its possible to specify explicitly the getter or setter.

  • Allow to change the Global configuration and helpers.
    The package exports Global, which can be used to change the logic of creating and outputting a message.

  • Polyfill free, TypeScript and ES5 compatibility.
    There is no need for any polyfill and can be fully used with TypeScript (d.ts) and ES5.

  • Intelligent and backward compatible (ES5 vs ES2015+).
    Ensures correct use of the decorator and verifies whether the property can be decorated by checking the attributes of the descriptor.

  • Advanced decoration and synergy with other decorators.
    Logic respects the original method and other decorators, so all the attributes of the descriptor not related to this decorator will be kept or adapted.

  • Extensive source documentation and testing coverage.
    Source code is fully documented and tested for each line.

Future

The package includes an implementation of the decorator using the TypeScript syntax and will be extended in future with the new proposal from TC39.

We are actively supporting the package, so please contact us at GitHub or Gitter if you have any suggestions or questions.