Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

Text · 14 lines · 501 B · at eb4a6ea

import { Some, None, type Option } from "@tsus/runtime";import { circle, type Shape } from "./shapes.tsus";export const area = (s: Shape): number =>  match (s) {    Circle(r) => Math.round(Math.PI * r * r),    Square(side) => side * side,  };// No annotation: the declaration has to name Shape from the other module.export const unit = () => circle(1);export const largest = (shapes: readonly Shape[]): Option<number> =>  shapes.length === 0 ? None : Some(Math.max(...shapes.map(area)));