NearestInSpacetype
One answer of a query by distance in space.
Import it
import type { NearestInSpace } from "@johnmorrisdotca/hoshi-stars/nearest";
Definition
interface NearestInSpace<T extends Star | NearbyStar = Star> {
thing: T;
distance: number;
parsecs: number;
error: number | undefined;
}
Members
| Name | Type | Description |
|---|---|---|
thing | T | The star. |
distance | number | The distance from the target in light-years, from the two parallaxes and the angle between them. |
parsecs | number | The same distance in parsecs. |
error | number | undefined | The uncertainty of |
Examples
import { nearest, type NearestInSpace } from "@johnmorrisdotca/hoshi-stars/nearest";
const first: NearestInSpace = nearest("Sirius", { by: "space", count: 1 })[0]!;
console.log(first.thing.name, first.distance.toFixed(1), "light-years");Procyon 5.1 light-yearsWhat it prints (run when this page was built)