diff --git a/package.json b/package.json index 29d0531..f58b81e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@overflow/core-js", - "version": "0.0.7", + "version": "0.0.10", "description": "TypeScript library setup for multiple compilation targets using tsc and webpack", "main": "./bundles/index.umd.js", "module": "./esm5/index.js", diff --git a/src/decorator/Decorator.ts b/src/decorator/Decorator.ts index 37c79fa..7562f6a 100644 --- a/src/decorator/Decorator.ts +++ b/src/decorator/Decorator.ts @@ -14,7 +14,7 @@ export interface Decorator { parameterDecorator?: (target: Object, propertyKey: PropertyKeyType, parameterIndex: number) => void; } -export abstract class Decorator extends Annotation { +export abstract class Decorator extends Annotation { public constructor(attribute?: Attribute) { super(attribute); diff --git a/src/decorator/DecoratorHelper.ts b/src/decorator/DecoratorHelper.ts index 9fbd524..c43c183 100644 --- a/src/decorator/DecoratorHelper.ts +++ b/src/decorator/DecoratorHelper.ts @@ -6,7 +6,6 @@ import { } from '../core'; import { - Annotation, Class, Constructor, Field, @@ -23,19 +22,21 @@ import { Decorator } from './Decorator'; export class DecoratorHelper { - public static register(attribute: AttributeType, ...decoratorArgs: any[]) { - const annotation = new Annotation(attribute); - const name: string = Annotation.name; + public static register(DecoratorClass: Type>, attribute?: Attribute) { + const annotation: Decorator = new DecoratorClass(attribute); + const name: string = DecoratorClass.name; - DecoratorHelper.registerAnnotation(name, annotation, decoratorArgs); + return function (...decoratorArgs: any[]) { + return DecoratorHelper.registerAnnotation(name, annotation, decoratorArgs); + }; } - public static create = (DecoratorClass: Type>) => { - return (attribute: Attribute) => { + public static create(DecoratorClass: Type>) { + return function (attribute?: Attribute) { const annotation: Decorator = new DecoratorClass(attribute); const name: string = DecoratorClass.name; - return (...decoratorArgs: any[]) => { + return function (...decoratorArgs: any[]) { return DecoratorHelper.registerAnnotation(name, annotation, decoratorArgs); }; };