I'm trying to define a class in ecmascript 6.
Here is the code :
class Machine {
constructor (){
this._context = null;
}
get context (){
return this._context;
}
set context (context){
this._context = context;
}
}
But I always get the same error for the setter in Webstorm : "Set accessor method has type that is not compatible with get accessor type"
I don't understand why I get this error. I did exactly as explained here : http://es6-features.org/#GetterSetter
EDIT : It seems that the problem is only present because I defined my class in an angular factory.
So my question is how can I define a class properly in an angular factory ?
Maybe I'm not supposed to do it like that.
EDIT 2 : Here is my angular factory :
angular.module('frontEndApp')
.factory('Machine', function () {
class Machine {
constructor (){
this._context = null;
}
get context (){
return this._context;
}
set context (context){
this._context = context;
}
}
return Machine;
}