-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScriptType does not support class syntax #6316
Comments
This also applies to other complex types: vec2, entity, ... |
Thanks @AlexAPPi, you've hit on an important point. When an ES6 class members is defined, it is non configurable. Currently ScriptAttribute attempts to redefine the member using class Test { fail = 'should be overridden' }
Object.defineProperty(Test.prototype, 'fail', { value: 100 });
test = new Test()
console.log(test.fail) // 'should be overridden' I've created an editor repro here For the time being, you'll need to avoid declaring attribute in the class body, or alternatively use the |
At the moment, the issue can be very obscure, as it doesn't warn the developer. This can lead to bugs that are hard to debug. We should add a warning. |
Yep this is not ideal, but unfortunately I don't think this is possible to catch at run-time without instantiating the class first. A solution is to prevent users using the class notation or declaring members in the class body. Neither are ideal. |
Script argument type conversion does not occur if both a property and a script attribute exist.
The text was updated successfully, but these errors were encountered: