- Part of firedev.io
- Helpers for OOP (Object Oriented Programming) in TypeScript.
- Keep classnames metadata when minifying code (uglifyjs, webpack)
- Purpose:
- take advantage of classes in TypeScript/JavaScript in most glegant way
- prevent unusable class names during JS minification
npm i typescript-class-helpers
import { CLASS } from 'typescript-class-helpers';
@CLASS.NAME('Example')
class Example {
}
console.log(CLASS.getName(Example) === 'Example') // true
console.log(CLASS.getNameFromObject(new Example()) === 'Example') // true
console.log(CLASS.getBy('Example') === Example) // true
import { CLASS } from 'typescript-class-helpers/browser';
@CLASS.NAME('Example')
class Example {
}
console.log(CLASS.getName(Example) === 'Example') // true
console.log(CLASS.getNameFromObject(new Example()) === 'Example') // true
console.log(CLASS.getBy('Example') === Example) // true
This way you can use you class names even after uglify process.