From fba9e42c4eb9c50e159c2c08084bdb7ff36325e5 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 6 Sep 2018 12:30:22 +0900 Subject: [PATCH] ing --- package.json | 2 +- src/decorator/Decorator.ts | 2 +- src/decorator/DecoratorHelper.ts | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) 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); }; };