You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decorators doesn't get resolved in the order that they're being applied.
For instance, if we take this class:
@Module()
export class Server {
@Lifecycle.subscribe()
create() {
// ...
}
@Lifecycle.subscribe()
start() {
// ...
}
}
it get's transpiled to:
// ...
let Server = class Server {
create() {
}
start() {
}
};
__decorate([
Lifecycle_1.Lifecycle.subscribe(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], Server.prototype, "create", null);
__decorate([
Lifecycle_1.Lifecycle.subscribe(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], Server.prototype, "start", null);
Server = __decorate([
Module_1.Module()
], Server);
exports.Server = Server;
As you can see in the upper section of code, I defined the Module decorator before the others, but weird enough it gets transpiled as the last in the order.
It shouldn't be this way.
Currently I don't think that there's a workaround for me, as it depends on being defined first because it binds the class to a dependency injection container.
The text was updated successfully, but these errors were encountered:
Thanks I'll try it out.
Would it work if I disabled experimentalDecorators in my tsconfig.json and started using this combined with Babel and TypeScript?
Decorators doesn't get resolved in the order that they're being applied.
For instance, if we take this class:
it get's transpiled to:
As you can see in the upper section of code, I defined the
Module
decorator before the others, but weird enough it gets transpiled as the last in the order.It shouldn't be this way.
Currently I don't think that there's a workaround for me, as it depends on being defined first because it binds the class to a dependency injection container.
The text was updated successfully, but these errors were encountered: