-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationpkg:dim-sidim-si packagedim-si package
Description
Users of dim-si shouldn't need to reach into lower-level packages (dim-quantity, dim-unit) to annotate their functions. The key types for function signatures are Linear and Affine (from dim-unit), which express whether a parameter is a regular quantity or an affine one (like absolute temperature).
Approach:
- Re-export
LinearandAffinefrom@isentropic/dim-siroot module - Document
Linearfor standard quantity annotations (e.g.,Linear<Length>,Linear<Velocity>) - Document
Affinefor affine quantities (e.g.,Affine<Temperature>) - Update README prose to explain
LinearvsAffineinstead of referencingQuantity
Example of what end-user code should look like:
import type { Linear } from "@isentropic/dim-si";
import type { Length } from "@isentropic/dim-si/length";
import type { Time } from "@isentropic/dim-si/time";
import type { Velocity } from "@isentropic/dim-si/velocity";
import { divide } from "@isentropic/dim-si/ops";
function speed(
distance: Linear<Length>,
duration: Linear<Time>,
): Linear<Velocity> {
return divide(distance, duration);
}import type { Affine } from "@isentropic/dim-si";
import type { Temperature } from "@isentropic/dim-si/temperature";
import { kelvin } from "@isentropic/dim-si/temperature";
import { q } from "@isentropic/dim-si/ops";
function toKelvin(temp: Affine<Temperature>): number {
return q(temp).in(kelvin);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationpkg:dim-sidim-si packagedim-si package