In type script, property can be defined as
get someprop(): boolean {return a === b;}
Is it possible to use arrow operator here ? something like
get someprop() => a === b ;
CodePudding user response:
No, setter/getter syntax in JavaScript requires using:
get propName() {
// function body
}
or
set propName() {
// function body
}
There aren't any other options, unfortunately, if you have to use a setter or getter.
Standard properties in an object literal can use arrow functions, of course.
const obj = {
someprop: () => a === b
};