-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
It could be cool to add decorators methods
class Person {
firstName: string = "Jon"
lastName: string = "Doe"
@monitored
getFullName () {
return `${this.firstName} ${this.lastName}`;
}
}
instead of we doing now a lot of
class Person {
firstName: string = "Jon"
lastName: string = "Doe"
getFullName () {
return monitored('getFullName', () => {
return `${this.firstName} ${this.lastName}`;
});
}
}
The drawbacks are that decorators for now can only be applied on class declaration, method, accessor, property, or parameter (not raw functions), and are an experimental feature (TS experimental JS stage 2 proposal). I feel it's not a problem as sooner or later it will be standardized and we can do the small adjustment later. Many big frameworks used or use decorators despite it, and after all, we provide it as optional opt-in feature.
NathanHazout
Metadata
Metadata
Assignees
Labels
No labels