refactor: improve sensor and satellite class design patterns #43
+42
−121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This refactor removes several anti-patterns and makes the class hierarchy more flexible:
Removed manual type-checking methods: Replaced isSatellite(), isSensor(), isGroundObject(), and isMarker() methods with instanceof checks. This is more idiomatic TypeScript and reduces boilerplate code across the class hierarchy.
Removed unused FOV2 system: The Sensor class had secondary field-of-view parameters (minRng2, maxRng2, etc.) that were validated but never used in any FOV calculations. This dead code has been removed from both the Sensor class and SensorParams interface.
Made DetailedSatellite parameters optional: Changed constructor from requiring all four interfaces (DetailedSatelliteParams & LaunchDetails & OperationsDetails & SpaceCraftDetails) to making the detail interfaces optional using Partial<>. This removes the "all or nothing" pattern and allows child classes more flexibility.
Updated tests: Modified BaseObject tests to use instanceof checks instead of the removed type-checking methods.
All existing tests pass (97 test suites, 26,185 tests).