Support static members
This commit is contained in:
parent
563d5d9c34
commit
904229a885
@ -66,7 +66,9 @@ export default ({ types: t }: typeof babel): babel.PluginObj<State> => ({
|
|||||||
modifiers.push(
|
modifiers.push(
|
||||||
t.callExpression(state.__decorate(), [
|
t.callExpression(state.__decorate(), [
|
||||||
t.arrayExpression(child.decorators.map(d => d.expression)),
|
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.isIdentifier(child.key) ? t.stringLiteral(child.key.name) : child.key,
|
||||||
t.unaryExpression("void", t.numericLiteral(0)),
|
t.unaryExpression("void", t.numericLiteral(0)),
|
||||||
])
|
])
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
class A {
|
class A {
|
||||||
@dec prop: string
|
@dec prop: string
|
||||||
@dec @dec2 prop2: string
|
@dec @dec2 prop2: string
|
||||||
|
@dec static staticProp: number
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,9 @@ import { __decorate } from "tslib"
|
|||||||
class A {
|
class A {
|
||||||
prop: string;
|
prop: string;
|
||||||
prop2: string;
|
prop2: string;
|
||||||
|
static staticProp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
__decorate([dec], A.prototype, "prop", void 0);
|
__decorate([dec], A.prototype, "prop", void 0);
|
||||||
__decorate([dec, dec2], A.prototype, "prop2", void 0);
|
__decorate([dec, dec2], A.prototype, "prop2", void 0);
|
||||||
|
__decorate([dec], A, "staticProp", void 0);
|
Loading…
x
Reference in New Issue
Block a user