diff --git a/src/index.ts b/src/index.ts index fc89d9c..6c29a8d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,9 @@ export default ({ types: t }: typeof babel): babel.PluginObj => ({ modifiers.push( t.callExpression(state.__decorate(), [ t.arrayExpression(child.decorators.map(d => d.expression)), - t.memberExpression(classID, t.identifier("prototype")), + child.static + ? classID + : t.memberExpression(classID, t.identifier("prototype")), t.isIdentifier(child.key) ? t.stringLiteral(child.key.name) : child.key, t.unaryExpression("void", t.numericLiteral(0)), ]) diff --git a/test/snapshots/properties/input.txt b/test/snapshots/properties/input.txt index 4a62286..0bfec8e 100644 --- a/test/snapshots/properties/input.txt +++ b/test/snapshots/properties/input.txt @@ -1,4 +1,5 @@ class A { @dec prop: string @dec @dec2 prop2: string + @dec static staticProp: number } diff --git a/test/snapshots/properties/output.txt b/test/snapshots/properties/output.txt index 6a8edc3..635fa00 100644 --- a/test/snapshots/properties/output.txt +++ b/test/snapshots/properties/output.txt @@ -3,7 +3,9 @@ import { __decorate } from "tslib" class A { prop: string; prop2: string; + static staticProp: number; } __decorate([dec], A.prototype, "prop", void 0); -__decorate([dec, dec2], A.prototype, "prop2", void 0); \ No newline at end of file +__decorate([dec, dec2], A.prototype, "prop2", void 0); +__decorate([dec], A, "staticProp", void 0); \ No newline at end of file