SpaceNeighbourtype
A body near the target in space: the distance between their centres, and how far that may be off.
Import it
import type { SpaceNeighbour } from "@johnmorrisdotca/wakusei-planets/nearest";
Definition
interface SpaceNeighbour {
id: BodyId;
kind: NearestKind;
distanceKm: number;
distanceAu: number;
uncertaintyKm: number;
}
Members
| Name | Type | Description |
|---|---|---|
id | BodyId | |
kind | "moon" | "star" | "planet" | "dwarf-planet" | |
distanceKm | number | The distance between the two centres at the date, kilometres. |
distanceAu | number | The same in astronomical units. |
uncertaintyKm | number | The accuracy to expect of |
Examples
import { nearest, type SpaceNeighbour } from "@johnmorrisdotca/wakusei-planets/nearest";
const next: SpaceNeighbour | undefined = nearest("earth", { by: "space", count: 1, date: Date.UTC(2026, 10, 8) })[0];
console.log(next?.id, Math.round(next?.distanceKm ?? 0));moon 393763What it prints (run when this page was built)