diff --git a/packages/dim-si/README.md b/packages/dim-si/README.md index 5910871..23d659c 100644 --- a/packages/dim-si/README.md +++ b/packages/dim-si/README.md @@ -109,6 +109,38 @@ const picogram = gram.scaled(PICO); See [prefixes.ts](./src/prefixes.ts) for all available SI prefixes. +## Type Annotations + +Each unit module exports a dimension type (e.g., `Length`, `Velocity`). Wrap +these with `Quantity` to annotate function parameters and return types: + +```typescript +import type { Quantity } from "@isentropic/dim-quantity"; +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: Quantity, + duration: Quantity