Summary
Follow-up cleanup after v1.0.0 release. Branch: `refactor/arc-cleanup` on thomas-hervey/arc.js
Changes
Remove unreachable null guards in `json()`
The `!firstGeometry` check inside the `length === 1` branch can never be true - index 0 is guaranteed by the length check. Removed and replaced with a non-null assertion (`!`) plus an inline comment explaining the invariant.
The `.filter(geom => geom !== undefined)` in the MultiLineString branch is also unreachable - `geometries` is typed `_LineString[]` and only populated by `GreatCircle.Arc()`.
Remove unreachable null guard in `wkt()`
The `!geometry` check in the loop has the same problem. Removed. The `coords.length === 0` guard is kept - that branch is reachable if an empty `_LineString` is pushed directly.
Simplify `wkt()` coord mapping
Dropped the redundant `.filter(coord => coord !== undefined)` and `?? 0` fallbacks. Coords are typed `[number, number]` tuples so neither guard does anything.
Update JSDoc examples
Both the class-level example and the `wkt()` example previously showed direct `Arc` construction, which is not the public API. Updated to show the realistic `GreatCircle -> Arc` path.
Result
`arc.ts` goes from 93% to 100% statement/branch coverage without adding tests for impossible states.
Summary
Follow-up cleanup after v1.0.0 release. Branch: `refactor/arc-cleanup` on thomas-hervey/arc.js
Changes
Remove unreachable null guards in `json()`
The `!firstGeometry` check inside the `length === 1` branch can never be true - index 0 is guaranteed by the length check. Removed and replaced with a non-null assertion (`!`) plus an inline comment explaining the invariant.
The `.filter(geom => geom !== undefined)` in the MultiLineString branch is also unreachable - `geometries` is typed `_LineString[]` and only populated by `GreatCircle.Arc()`.
Remove unreachable null guard in `wkt()`
The `!geometry` check in the loop has the same problem. Removed. The `coords.length === 0` guard is kept - that branch is reachable if an empty `_LineString` is pushed directly.
Simplify `wkt()` coord mapping
Dropped the redundant `.filter(coord => coord !== undefined)` and `?? 0` fallbacks. Coords are typed `[number, number]` tuples so neither guard does anything.
Update JSDoc examples
Both the class-level example and the `wkt()` example previously showed direct `Arc` construction, which is not the public API. Updated to show the realistic `GreatCircle -> Arc` path.
Result
`arc.ts` goes from 93% to 100% statement/branch coverage without adding tests for impossible states.