whatisgithub

What is core-decorators?

jayphelps/core-decorators — explained in plain English

Analysis updated 2026-06-26

4,497JavaScriptAudience · developerComplexity · 2/5Setup · moderate

In one sentence

A JavaScript library of ready-made class decorators like @autobind and @readonly, but built against an outdated spec, best avoided for new projects in favor of modern alternatives.

Mindmap

mindmap
  root((core-decorators))
    What It Does
      Ready-made decorators
      Class method helpers
    Key Decorators
      autobind
      readonly
      deprecate
      mixin
    Intended Use
      React projects
      Angular projects
    Limitations
      Old spec stage-0
      Mostly unmaintained
    Setup
      Babel legacy plugin
      npm install
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add @autobind to React component methods to avoid manual this-binding in constructors

USE CASE 2

Mark old methods with @deprecate to warn other developers they should stop using them

USE CASE 3

Use @readonly to prevent accidental reassignment of class properties at runtime

USE CASE 4

Mix reusable behaviors into a class with @mixin without changing its inheritance chain

What is it built with?

JavaScriptBabel

How does it compare?

jayphelps/core-decoratorshotheadhacker/seedbox-liteyomguithereal/react-blessed
Stars4,4974,4984,499
LanguageJavaScriptJavaScriptJavaScript
Setup difficultymoderatemoderatemoderate
Complexity2/53/53/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires babel-plugin-transform-decorators-legacy, not compatible with modern decorators spec.

So what is it?

core-decorators is a JavaScript library that provides a set of ready-made decorators for use with classes and class methods. Decorators are a syntax feature that lets you attach behavior to a function or class by placing an annotation (starting with @) directly above it, similar to how annotations work in Java or Python. For example, placing @autobind above a method ensures that the method always refers to its own class instance even when passed around as a standalone function, a common headache in React development. Placing @readonly on a property prevents it from being reassigned. Placing @deprecate on a method logs a console warning when the method is called, signaling to other developers that they should stop using it. The full list of decorators in the library includes @autobind, @readonly, @override, @deprecate, @suppressWarnings, @nonenumerable, @nonconfigurable, @lazyInitialize, @time, @profile, and @mixin, among others. Several of these are marked as deprecated within the library itself because the scope has been narrowed over time. An important caveat is stated at the top of the README: this library was written against an early draft of the JavaScript decorators specification (stage-0) that has since changed in incompatible ways. The decorators proposal has moved to a substantially different stage-2 form. As a result, the README explicitly says the library should mostly be considered unmaintained and is probably best avoided for new projects. It will only receive security or critical fixes until the decorator specification stabilizes further. The library was designed to work with Babel 5 or with the babel-plugin-transform-decorators-legacy plugin. It does not officially support TypeScript. It has no framework dependency and was widely used in React and Angular projects during the period when this version of the decorator spec was common.

Copy-paste prompts

Prompt 1
How do I use @autobind from core-decorators to fix 'this is undefined' errors in my React component methods?
Prompt 2
Show me how to apply @deprecate from core-decorators so it logs a warning when an old API method is called
Prompt 3
Using core-decorators, how do I make a class property @readonly so it throws when someone tries to reassign it?
Prompt 4
My project uses core-decorators but the decorators spec changed, what modern replacement should I migrate to?

Frequently asked questions

What is core-decorators?

A JavaScript library of ready-made class decorators like @autobind and @readonly, but built against an outdated spec, best avoided for new projects in favor of modern alternatives.

What language is core-decorators written in?

Mainly JavaScript. The stack also includes JavaScript, Babel.

How hard is core-decorators to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is core-decorators for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.