I am encountering an issue in my code where I define a private class member using "#", initialize it in the constructor, and then receive an error when attempting to set/access the value.
Uncaught TypeError: Cannot read private member #mouse from an object whose class did not declare it
at mouseDownEvent
The error occurs within the mouseDownEvent function when trying to access the values.
Here is an example of the code (refer to the EDIT code)
class Testing
{
#property;
constructor()
{
this.#property = new Vector2();
}
mouseDownEvent()
{
this.#mouse.x = somevalue; <- error is here
}
}
EDIT
class Testing
{
#mouse;
constructor()
{
this.#mouse= new Vector2();
}
mouseDownEvent()
{
this.#mouse.x = somevalue; <- error is here
}
}