Open
Description
Decorators for classes, methods, and object properties are a really nice extension to the language. The only extra one I would like to see is the ability to add decorators to function declarations:
@RunOnce
function expensiveOperation() {
return 1 + 1;
}
de-sugars to:
var expensiveOperation = RunOnce(function expensiveOperation() {
return 1 + 1;
});
This suggests allowing decorators for any assignment, but I think that might be a bit much so I'm leaving it out of this PR:
// For the curious, that would allow constructs like this
@RunOnce
let expensiveOp = () => 1 + 1
// De-sugars to
let expensiveOp = RunOnce(() => 1 + 1);
Metadata
Assignees
Labels
No labels