forked from flyover/box2d.ts
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Cleanupgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
In flyovers port, almost all members have been made public. Probably due to TypeScript not having a "friend" concept as C++ does.
This should be avoided. Possible alternatives:
- Using the respective getter/setter methods
- Introducing actual getter/setter (language feature)
- Accessing private attributes using the bracket syntax, which bypasses the protection:
class A {
private x = 0;
}
const a = new A();
a["x"] = 10; // no errorThis style should only be used as a last resort internally to imitate the "friend" concept of C++.
I usually only use this in tests, where I want to access/modify data, which is otherwise not allowed to be touched.
Update: After trying this a bit, it causes other issues. Like false detection of unused properties (property is only being written, not being read)
Update 2:
As said in the comments, I've written idtsc to get this working. The core project has been extended with this technique. The other projects might need adjustments as well.
Projects to adjust:
- controllers
- core
- lights
- particles
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Cleanupgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed