Skip to content

refactor: Extract GpsSensorConfig into a shared exported type #2735

Description

@coderabbitai

Summary

The anonymous gpsSensors array element shape in src/config/config.ts is duplicated across multiple modules. Extracting it into a named, exported type (GpsSensorConfig) will prevent drift and make the contract explicit across the codebase.

Scope

  1. src/config/config.ts — declare and export GpsSensorConfig (or a canonical location such as packages/server-api/src/), replace the inline anonymous shape in Config.settings.gpsSensors? with GpsSensorConfig[].
  2. src/serverroutes.ts — import and reuse GpsSensorConfig instead of redeclaring the shape inline.
  3. src/api/gpsOffsetCorrector/index.ts — import and reuse GpsSensorConfig for the corrector's payload type.
  4. Test fixtures (test/api/gpsOffsetCorrector.test.ts and any other files that declare the shape locally) — update to import the shared type.

Background

Identified during review of PR #2399 (feat: Multi-GPS antenna position configuration). The shape { sensorId: string; sourceRef: string; fromBow: number | null; fromCenter: number | null } is currently inlined anonymously in Config.settings.gpsSensors and repeated elsewhere. Agreed to address in a follow-up PR to keep the round-2 bugfixes atomic.

References

/cc @dirkwa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions