Reference · The <wakusei-space> element: the Earth, Moon, Sun and planets in their places
BodyInfotype
What a page can tell a reader about a body now.
Import it
import type { BodyInfo } from "@johnmorrisdotca/wakusei-planets/space/element";
Definition
interface BodyInfo {
id: SpaceBody;
name: string;
radiusKm: number;
distanceKm: number;
}
Members
| Name | Type | Description |
|---|---|---|
id | "sun" | "mercury" | "venus" | "earth" | "mars" | "jupiter" | "saturn" | "uranus" | "neptune" | "pluto" | "moon" | |
name | string | The name shown beside the body. |
radiusKm | number | Mean radius, kilometres. |
distanceKm | number | Distance from the Earth's centre now, kilometres (0 for the Earth). |
Examples
import type { BodyInfo } from "@johnmorrisdotca/wakusei-planets/space/element";
const info: BodyInfo = { id: "mars", name: "Mars", radiusKm: 3389.5, distanceKm: 225_000_000 };
console.log(`${info.name}: ${info.radiusKm} km`);