A simple and obvious issue I've just stumbled on is serializing to JSON using JSON.stringify
.
If you're not aware already, it doesn't work, JSON.stringify
won't use any of the getters:
class MyClass {
get m() { return 1; }
}
JSON.stringify(new MyClass()); // writes empty object {}
Am I missing something regarding JSON serialization? I am already aware of implementing toJSON().
Classes still seem half baked after many years, I am starting to question why use them after all.