diff --git a/src/objects/BaseObject.ts b/src/objects/BaseObject.ts index 6da279a..4877d97 100644 --- a/src/objects/BaseObject.ts +++ b/src/objects/BaseObject.ts @@ -25,7 +25,7 @@ import { BaseObjectParams } from '../interfaces/BaseObjectParams'; import { EciVec3, Kilometers, SpaceObjectType } from '../types/types'; export class BaseObject { - id?: number; // Unique ID + id: number; name: string; type: SpaceObjectType; position: EciVec3; // Where is the object @@ -36,7 +36,7 @@ export class BaseObject { constructor(info: BaseObjectParams) { this.type = info.type ?? SpaceObjectType.UNKNOWN; this.name = info.name ?? 'Unknown'; - this.id = info.id; + this.id = info.id ?? -1; // Default to -1 if no id is provided this.active = info.active ?? true; // Default to the center of the earth until position is calculated diff --git a/test/objects/__snapshots__/GroundObject.test.ts.snap b/test/objects/__snapshots__/GroundObject.test.ts.snap index 91b808f..ea02b85 100644 --- a/test/objects/__snapshots__/GroundObject.test.ts.snap +++ b/test/objects/__snapshots__/GroundObject.test.ts.snap @@ -36,7 +36,7 @@ exports[`GroundObject should create from geodetic 1`] = ` GroundObject { "active": true, "alt": 0, - "id": undefined, + "id": -1, "lat": 0, "lon": 0, "name": "Unknown Ground Object", diff --git a/test/objects/__snapshots__/Satellite.test.ts.snap b/test/objects/__snapshots__/Satellite.test.ts.snap index 5e2e7bf..9924072 100644 --- a/test/objects/__snapshots__/Satellite.test.ts.snap +++ b/test/objects/__snapshots__/Satellite.test.ts.snap @@ -101,7 +101,7 @@ Satellite { "eccentricity": 0.0005168, "epochDay": 203.46960946, "epochYear": 22, - "id": undefined, + "id": -1, "inclination": 51.6415, "intlDes": "98067A", "meanAnomaly": 54.7009,