I am attempting to create a class in ecmascript 6.
Below is the code:
class Machine {
constructor (){
this._context = null;
}
get context (){
return this._context;
}
set context (context){
this._context = context;
}
}
However, I consistently encounter the same error for the setter in Webstorm: "Set accessor method has type that is not compatible with get accessor type"
I am puzzled as to why this error is occurring. I followed the instructions provided here:
EDIT: It appears that the issue only arises because I defined my class within an angular factory.
My question now is how can I correctly define a class within an angular factory?
Perhaps I am not supposed to do it in that manner.
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;
}