Documentation / @interstellar-tools/types
@interstellar-tools/types
Shared TypeScript types (3D tuples, branded radians, unit-carrying values, celestial body interfaces) used across the monorepo to keep APIs predictable and safe.
Documentation
The full documentation lives at phun-ky.net/interstellar-tools:
- Getting started: installation, unit conventions and recommended practices
- API reference for
@interstellar-tools/types: every export, with formulas, parameters and examples
Installation
- Node.js version 22.12.0 or higher
- ES modules;
require()needs Node 22.12 or later
shell
npm i --save @interstellar-tools/typesInterfaces
| Interface | Description |
|---|---|
| ForceResultInterface | Result of a Newtonian gravitational force computation between two point masses. |
| OdeSolutionInterface | The output of a numerical integration: the times, and the state at each. |
Type Aliases
| Type Alias | Description |
|---|---|
| Matrix3x3Type | Immutable 3×3 matrix of numbers. |
| OdeRightHandSideType | The right-hand side of a system of first-order ODEs, |
| Vector3DTupleType | A read-only 3D vector tuple [x, y, z]. |
Atmosphere
| Interface | Description |
|---|---|
| AtmosphereInterface | The state of the atmosphere at a place and a moment: its density, temperature and make-up. |
| SpaceWeatherInterface | The space weather an atmosphere model needs: how strongly the Sun heats the upper atmosphere, and how stirred up Earth's magnetic field is. Above about 200 km they change the air density tenfold. |
Cartography
| Interface | Description |
|---|---|
| EllipsoidInterface | A body's reference ellipsoid: the smooth surface that latitudes, longitudes and heights are measured on. |
| GeodeticCoordinatesInterface | A point's geodetic coordinates on an oblate body: latitude, longitude and height above the reference ellipsoid, in SI units and radians. |
| IlluminationAnglesInterface | The illumination angles at a point on a surface: where the light comes from and where it's seen from, relative to the surface and each other. |
| MoonPositionInterface | The Moon's position seen from Earth's centre at a moment: its direction on the sky and its distance. |
| SunPositionInterface | The Sun's position seen from Earth's centre at a moment: its direction on the sky and its distance. |
Celestial Bodies
| Name | Description |
|---|---|
| AsteroidBeltInterface | Represents an asteroid belt within the solar system simulation. |
| AsteroidInterface | Canonical shape for an asteroid record: identity, dynamics, and optional visualization aides. |
| BlackHoleInterface | Represents a black hole at the center of a galaxy. |
| CartesianCoordinatesInterface | Represents 2D coordinates, for example a point on a drawn orbit. |
| CometInterface | Represents a comet in the solar system simulation. |
| DisplayAstrosphereInterface | How to draw a star's astrosphere, its boundaries from the star's observations.astrosphere. |
| DisplayAtmosphereInterface | How to draw the glow of an atmosphere at the limb. |
| DisplayBandsInterface | How to draw a giant planet's belts and zones. |
| DisplayBlackHoleInterface | How to draw a black hole. |
| DisplayCloudsInterface | How to draw a cloud layer over a solid surface. |
| DisplayComaInterface | How to draw a comet's coma and tails. |
| DisplayCoronaInterface | How to draw a star's corona. |
| DisplayDerivationInterface | Why a drawing value is what it is: taken from images, worked out from an observation, or assumed. |
| DisplayEmissionInterface | Light the body gives off itself, such as a hot Jupiter's thermal glow. |
| DisplayGalaxyInterface | How to draw a galaxy. |
| DisplayIceCapsInterface | Polar ice caps on a solid surface. |
| DisplayInterface | How a body is drawn: everything about rendering, kept apart from its physical data, its orbit and its observations. |
| DisplayLavaInterface | Glowing lava cracks on a molten surface. |
| DisplayOceanInterface | Oceans on a solid surface. |
| DisplayPhotosphereInterface | How to draw a star's disc. |
| DisplayRingsInterface | How to draw a ring system. Its radii, rings and gaps are the measured ones, in the body's observations.rings. |
| DisplayStormInterface | An oval storm on a giant planet. |
| DisplaySurfaceInterface | How to draw a solid surface. |
| DisplayTailInterface | One comet tail to draw. |
| GalaxyDiskInterface | How a galaxy's disk is turned, as seen from the Sun. |
| GalaxyInterface | Represents a galaxy in the universe simulation. |
| IauPeriodicTermInterface | A periodic term in an IAU rotation model: an amplitude times the sine or cosine of an angle that grows with time. |
| IauRotationModelInterface | A body's IAU rotation model: which way its spin axis points, and how far it has turned, at any moment (Archinal et al. 2018). |
| InterstellarObjectInterface | An interstellar object: a body from another star's system, passing through the Solar System once, on an open orbit around the Sun. The IAU's Minor Planet Center designates them with an I: 1I/ʻOumuamua, 2I/Borisov, 3I/ATLAS. |
| MoonInterface | Represents a moon (natural satellite) orbiting a planet, a dwarf planet or an asteroid. |
| PlanetInterface | Represents a planet or planetoid. |
| RotationInterface | How a star, planet, moon, asteroid or comet spins: its sidereal rotation period, one turn against the stars. |
| StarInterface | Represents a star. |
| SystemInterface | Represents a system: the barycenter (centre of mass) that its members orbit. |
| AsteroidBeltsType | Type alias for a collection of asteroid belts. |
| AsteroidCategory | More specific group/category for dynamical families or special bodies. |
| AsteroidSpectralType | Spectral (taxonomic) class based on reflectance spectra & albedo. |
| AsteroidsType | Convenience alias for a list of asteroids. |
| AsteroidType | High-level orbital class of an asteroid (by dynamical region). |
| BlackHolesType | Type alias for a collection of black holes. |
| CelestialBodiesType | A list of celestial bodies of any kind: stars, planets, moons, comets and asteroids, mixed. Interstellar objects aren't included: their open orbits have their own type, InterstellarObjectInterface. |
| CelestialBodyType | Type alias representing a single celestial body. |
| CometsType | Type alias for an array of comets. |
| DisplayModelType | Which procedural model draws a body. |
| DisplayPaletteType | Three colours a procedural model blends between: lowland, midland and highland on a solid surface; belt, zone and accent on a giant planet. |
| GalaxiesType | Type alias for a collection of galaxies. |
| InterstellarObjectsType | Type alias for an array of interstellar objects. |
| MoonsType | Type alias for a collection of moons. |
| PlanetsType | Type alias for a collection of planets. |
| RingDisplayType | How to draw a planet's rings, and why the values are what they are. A part of DisplayInterface. |
| StarsType | Type alias for a collection of stars. |
| SystemKindType | Kind of system a barycenter holds together. |
| SystemsType | Type alias for a collection of systems. |
Distance
| Name | Description |
|---|---|
| DistanceInterface | Represents a distance measurement with an associated unit. |
| DistanceUnitAliasType | Human-friendly distance unit aliases accepted at input time. |
| DistanceUnitType | Canonical distance unit symbols for astronomy/space visualization. |
Numeric
| Name | Description |
|---|---|
| ValueInterface | Represents a numerical value. |
| DegreesType | Angle in degrees (branded nominal type). |
| Radians | Angle in radians (branded nominal type). |
Observations
| Name | Description |
|---|---|
| AsteroidObservationsInterface | What is measured about an asteroid. |
| AsteroidTaxonomyInterface | Spectral taxonomy finer than AsteroidSpectralType. |
| AstrometryInterface | Where a body outside the Solar System is on the sky, and how it moves. |
| AstrosphereBoundaryInterface | A boundary of an astrosphere, by how far it lies from the star in three directions. The bubble is blunt on the side the interstellar wind blows from and drawn out behind, so one radius doesn't describe it. |
| AstrosphereCrossingInterface | A probe crossing an astrosphere's boundary, as the Voyagers crossed the Sun's. |
| AstrosphereInterface | A star's astrosphere, the bubble its wind blows into the interstellar medium: the Sun's is the heliosphere. |
| AtmosphericFeatureInterface | A lasting feature of an atmosphere, such as a storm. |
| BlackHoleObservationsInterface | What is measured about a black hole. Its own mass (M☉) and ringDiameter stay the values the equations use. |
| CloudLayerInterface | An observed cloud or haze layer. |
| CometActivityInterface | A comet's activity: its coma, tails and outgassing. |
| CometNucleusInterface | A comet's nucleus. |
| CometObservationsInterface | What is measured about a comet. |
| CometProductionRateInterface | How fast a comet gives off one species. |
| CometTailInterface | One observed comet tail. |
| DiscoveryInterface | How and when a body was discovered. |
| EpochInterface | A moment as a Julian date on a named time scale, as catalogues give osculating epochs and transit times. |
| ExoplanetObservationsInterface | What is measured about a planet outside the Solar System. |
| GalaxyMorphologyInterface | GalaxyInterface.type split into its parts. |
| GalaxyObservationsInterface | What is measured about a galaxy. |
| IdentifiersInterface | Catalogue identifiers, besides the body's own id and name. |
| ImpactExperimentInterface | What a kinetic impact did to a moon, as DART's did to Dimorphos. |
| ImpactRiskInterface | An impact risk assessment of a near-Earth object. |
| InterstellarObjectObservationsInterface | What is measured about an interstellar object. |
| LimbDarkeningInterface | A fitted limb-darkening law, in one band. |
| MagnetosphereInterface | A body's magnetic field. |
| MagnitudeLawInterface | A comet's magnitude law: |
| MassPropertiesInterface | Measured mass and gravity. The body's own mu stays the value the equations use. |
| MissionVisitInterface | A spacecraft's visit to a small body. |
| MoonObservationsInterface | What is measured about a moon. |
| NonGravitationalInterface | The non-gravitational parameters of Marsden's model. |
| ObservationMetaInterface | What can travel with any measured value. |
| ObservationSourceInterface | Where a value came from. |
| ObservedProperMotionInterface | A proper motion with an uncertainty for each component, in mas/yr. |
| ObservedRangeInterface | A quantity given as a range, such as a surface's day and night temperatures. |
| OrbitSolutionInterface | The orbit determination behind orbit: how well its elements are known. |
| PlanetaryAtmosphereInterface | A body's atmosphere, as observed. Not AtmosphereInterface, which is Earth's upper atmosphere from a model. |
| PlanetObservationsInterface | What is measured about a planet or planetoid. |
| ReflectanceInterface | How bright a body is, and how it reflects light. |
| RingGapInterface | A named gap in a ring system, such as the Cassini Division. |
| RingInterface | One ring of a planet. |
| RingSystemInterface | A planet's ring system, in its equator's plane. |
| RotationObservationsInterface | Light-curve results that RotationInterface has no room for. |
| SizeObservationsInterface | Measured size and shape, with uncertainties. The body's radius and ellipsoid stay the values the equations use. |
| SolidBodyObservationsInterface | What every solid or planetary body can have measured: planets, moons and small bodies. |
| SpeciesAbundanceInterface | A chemical species, and how much of it there is. |
| SpectralClassificationInterface | StarInterface.type split into its parts. A class given as a range, such as Spica's 'B1III-IV' or Betelgeuse's 'M1-M2Ia-Iab', takes both ends. |
| StarObservationsInterface | What is measured about a star. Its own mass (M☉) and radius stay the values the equations use; these carry uncertainties and methods. |
| StellarActivityInterface | A star's magnetic activity. |
| SurfaceObservationsInterface | What a solid surface is made of, and looks like. |
| ThermalObservationsInterface | Measured temperatures and heat. |
| TransitObservationsInterface | Transit measurements of an exoplanet. |
| UncertaintyInterface | An uncertainty, in the value's own unit. Equal plus and minus is a symmetric ±σ. |
| VariabilityInterface | How a star's brightness varies. |
| ActiveNucleusType | The class of an active galactic nucleus. |
| AstrosphereBoundaryType | The boundaries of an astrosphere: |
| BlackHoleMassMethodType | How a black hole's mass was measured. |
| ByBodyIdType | Observations and drawing groups apart from the bodies, keyed by body id, as @interstellar-tools/constants exports them: STAR_PARAMETERS, PLANET_RINGS and the like. |
| DistanceMethodType | How a galaxy's distance was measured. |
| ExoplanetDetectionMethodType | How an exoplanet was found. |
| LuminosityClassType | The MK luminosity classes. |
| MagnitudesByBandType | Magnitudes by photometric band. |
| ObservationCatalogType | The catalogues the datasets in @interstellar-tools/constants draw on. Any other name is accepted too. |
| ObservedType | Any unit-carrying value with measurement metadata. A plain value of the same kind fits too. |
| PhotometricBandType | Photometric bands: Johnson–Cousins, 2MASS, Gaia, SDSS, WISE and GALEX. Any other band is accepted too. |
| ProvenanceType | How a value was obtained. |
| StarAstrometryType | Where a star is on the sky and which catalogues list it: its identifiers, position, motion and apparent magnitudes, and its letter within its system. A part of StarObservationsInterface. |
| StarParametersType | What a star's light tells about it: its spectral class, temperature, luminosity, surface gravity and metallicity. A part of StarObservationsInterface. |
| StellarEvolutionaryStageType | Where a star is in its life. |
Orbits
| Name | Description |
|---|---|
| CelestialDirectionInterface | A direction on the sky, in the ICRF (the J2000 equator and equinox), in degrees as catalogues give it: the pole of a reference plane, for example. |
| ClassicalElementsInterface | The six classical orbital elements of a two-body orbit, in SI units and radians. |
| EclipticDirectionInterface | A direction in ecliptic coordinates, against the J2000 ecliptic and equinox, in degrees: how a small body's spin pole or the interstellar wind's direction is often given. |
| FullOrbitInterface | An OrbitInterface with every orientation element given: i, w, om and q. Comets and asteroids carry these. |
| OpenOrbitInterface | An open orbit: a hyperbola, |
| OrbitFrameInterface | The frame of an orbit's orientation elements: the plane i, om and w are measured from, and that plane's pole where it isn't a standard one. |
| OrbitInterface | Kepler orbital elements of one body around its parent. |
| StateVectorInterface | A body's state vector: its position and velocity in an inertial frame centred on the body it orbits. |
| CwState | Clohessy–Wiltshire / Hill relative-motion state vector in the LVLH frame. |
| CwStateDerivative | Time derivative of CwState for CW/Hill dynamics. |
| OrbitReferencePlaneType | The reference plane an orbit's i, om and w are measured from. |
| PeriApoRadiiType | Peri/apoapsis radii pair. |
Positions
| Name | Description |
|---|---|
| GalacticDirectionInterface | A direction in galactic coordinates, from the Sun, in degrees as catalogues give it. |
| ObservedMotionInterface | The motion of something as seen from the Sun, as it's measured: its velocity along the line of sight, and where measured, its proper motion across the sky. |
| PositionInterface | A position in 3D, in a named frame: what a conversion such as galactocentricPosition in @interstellar-tools/equations returns, from a direction and distance measured from the Sun. |
| ProperMotionInterface | A proper motion: how fast something moves across the sky, in milliarcseconds per year, as catalogues give it. |
| SupergalacticDirectionInterface | A direction in supergalactic coordinates, from the Sun, in degrees. |
| VelocityInterface | A velocity in 3D, in a named frame, in km/s: the Sun's motion around the Milky Way's centre, for example, or a galaxy's, from its ObservedMotionInterface. |
| PositionFrameType | The frame of a PositionInterface. |
Quantities
| Name | Description |
|---|---|
| AccelerationInterface | An acceleration with its unit. |
| AngleInterface | A measured angle with its unit. |
| DensityInterface | A mass density with its unit. |
| DexInterface | A logarithmic quantity, in dex: a metallicity [Fe/H], log g, log R′HK, 12 + log(O/H). |
| DimensionlessInterface | A pure number: an albedo, an axis ratio, a Sérsic index, a redshift. It has no unit. |
| EnergyInterface | An energy with its unit. |
| EventRateInterface | How often something happens, with its unit. |
| FluxDensityInterface | A spectral flux density with its unit. |
| FractionInterface | A share of a whole with its unit. |
| GravitationalParameterInterface | A standard gravitational parameter |
| InverseDistanceInterface | An inverse distance, such as a long-period comet's original |
| IrradianceInterface | An energy flux through a surface: insolation, or heat flowing out of a body. |
| LuminosityInterface | A luminosity with its unit. |
| MagneticFieldInterface | A magnetic flux density with its unit. |
| MagneticMomentInterface | A magnetic dipole moment, in A m². |
| MagnitudeInterface | An astronomical magnitude: apparent, absolute, or a colour index. |
| MassInterface | A mass with its unit. |
| MassRateInterface | A mass flow rate with its unit. |
| PeriodChangeInterface | A change in a period, |
| PressureInterface | A pressure with its unit. |
| ProductionRateInterface | A comet's molecular production rate, in molecules a second. |
| SpeedInterface | A scalar speed with its unit: an escape speed, a radial-velocity semi-amplitude, a galaxy's rotation speed. For a velocity in 3D, see VelocityInterface. |
| SpinAccelerationInterface | A spin acceleration, |
| TemperatureInterface | A temperature, in kelvin. |
| ThermalInertiaInterface | Thermal inertia, in thermal inertia units: 1 TIU = 1 J m⁻² K⁻¹ s⁻½. |
| AccelerationUnitType | Canonical acceleration unit symbols: SI m/s2, cgs cm/s2, and au/d2, the unit JPL gives comets' and asteroids' non-gravitational parameters in. |
| AngleUnitType | Canonical angle unit symbols for measured angles, including the small ones on the sky: parallaxes, angular diameters, the sizes of galaxies. |
| DensityUnitType | Canonical density unit symbols: SI kg/m3, or g/cm3, as planetary fact sheets give bulk density. 1 g/cm³ = 1000 kg/m³. |
| EnergyUnitType | Canonical energy unit symbols, for example for flare energies. |
| EventRateUnitType | Canonical event rate unit symbols, for example for flare rates. |
| FluxDensityUnitType | Canonical flux density unit symbols, for radio astronomy. |
| FractionUnitType | Canonical fraction unit symbols, for abundances, coverages and transit depths. |
| GravitationalParameterUnitType | Canonical gravitational parameter unit symbols. The bodies' own mu is in m3/s2; JPL gives GM in km3/s2. |
| IrradianceUnitType | Canonical irradiance unit symbols: SI W/m2, or S_earth, the light Earth gets from the Sun, as exoplanet insolation is given: the IAU's 2015 nominal total solar irradiance, 1361 W/m². |
| LuminosityUnitType | Canonical luminosity unit symbols: W, erg/s, and L_sun, the IAU's 2015 nominal solar luminosity, 3.828 × 10²⁶ W. |
| MagneticFieldUnitType | Canonical magnetic field unit symbols: T, nT, and gauss, G, 10⁻⁴ T. |
| MassRateUnitType | Canonical mass rate unit symbols: dust from comets, mass lost by stars, stars formed in galaxies. |
| MassUnitType | Canonical mass unit symbols. |
| PeriodChangeUnitType | Canonical period change unit symbols: how fast a period lengthens. |
| PressureUnitType | Canonical pressure unit symbols, from Venus's 92 bar down to Pluto's 10 μbar. 1 bar = 10⁵ Pa. |
| SpeedUnitType | Canonical speed unit symbols. |
| SpinAccelerationUnitType | Canonical spin acceleration unit symbols: how fast a spin speeds up, as the YORP effect is given. |
Temporal
| Name | Description |
|---|---|
| LeapSecondInterface | One step in the leap second table: the offset TAI − UTC from a given UTC day on. |
| TemporalInterface | Typed container for a scalar duration, combining a numeric value (from ValueInterface) with a canonical TemporalUnitType unit. |
| TimeStepInterface | Represents a time step measurement in simulation, restricted to days. |
| TemporalUnitAliasType | Human-friendly temporal unit aliases accepted at input time. |
| TemporalUnitType | Canonical temporal unit symbols for spacetime/physics durations. |
| TimeScaleType | A time scale: the clock a moment is read on. |
Three-body
| Name | Description |
|---|---|
| Cr3bpUnitsInterface | The units of the normalised CR3BP frame for a pair of bodies, in SI. |
| LagrangePointsInterface | The five Lagrange points of two bodies circling each other: where a third, small body can stay put relative to them. |
| Cr3bpState | A state in the circular restricted three-body problem (CR3BP), in the rotating, normalised frame. |
| Cr3bpStateDerivative | The time derivative of a Cr3bpState: velocities, then accelerations. |
Tracking
| Name | Description |
|---|---|
| EphemerisInterface | An ephemeris: a table of a spacecraft's position and velocity over time, as JPL Horizons and the CCSDS Orbit Ephemeris Message (OEM) publish them. It's how deep-space probes, which have no TLEs, are tracked. |
| EphemerisSampleInterface | One sample of an ephemeris: a spacecraft's position and velocity at a moment. |
| GlobePointInterface | A point on an orthographic globe view: where it falls on the disc, and whether it's on the side facing the viewer. |
| LookAnglesInterface | Where a satellite is in an observer's sky: the direction to point an antenna or a camera, how far away it is and how fast that distance changes. |
| MeanElementsInterface | A satellite's mean elements, as published in a two-line element set (TLE) or an Orbit Mean-elements Message (OMM): the orbit SGP4 was fitted to at an epoch, with the drag terms it needs. |
| OmmRecordInterface | One Orbit Mean-elements Message (OMM) record in JSON, as CelesTrak publishes it: a satellite's mean elements, with the keywords of the CCSDS standard. |
| ProbeRecordInterface | A probe in the PROBES dataset of @interstellar-tools/tracking: a deep-space spacecraft, with what it is, where it's headed and a dated ephemeris. |
| SatellitePassInterface | One pass of a satellite over an observer: when it rises above the horizon, when it's highest, and when it sets. |
| SatelliteRecordInterface | A satellite in the SATELLITES dataset of @interstellar-tools/tracking: a stable id, a common name, its orbit regime and a dated OMM record. |
| OrbitRegimeType | The orbit regime a satellite flies in. |
| ProbeStatusType | Whether a space probe is still at work: 'active' while its mission operates it, 'ended' once contact is lost or the mission is over. An ended probe keeps flying: Pioneer 10 still coasts out of the Solar System. |
| ShadowType | Where a satellite is relative to Earth's shadow. |