ts-transformer-classname
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

ts-transformer-class-name

A typescript transformer that attaches the class name to each class type. It enables to recover the class name after a JS minimizer has been executed to the code base.

So for example if you have the class:

class MyClass {
  // class implementation...
}

After the transformer has been executed, you should have:

MyClass[CONSTRUCTOR_NAME_SYMBOL] === 'MyClass'

Usage

ttypescript can be used to integrate this transformer. After ttypescript is installed, you can reference the transformer in your tsconfig.json file:

{
    "compilerOptions": {
        "plugins": [
          { "transform": "ts-transformer-classname", "import": "classNameTransformer" }
        ]
    }
}

DI Compiler adapter

The adapter for DI Compiler is now provided. To use it:

{
    "compilerOptions": {
        "plugins": [
          { "transform": "ts-transformer-classname", "import": "diTransformerAdapter" }
        ]
    }
}

Release process

Run yarn release

Package Sidebar

Install

npm i ts-transformer-classname

Weekly Downloads

21

Version

2.0.0

License

Apache-2.0

Unpacked Size

33.3 kB

Total Files

16

Last publish

Collaborators

  • benoitvasseur
  • lucas-amiaud
  • amanteaux
  • benjaminchardin