diff --git a/src/engine/operations/helpers.ts b/src/engine/operations/helpers.ts index 6529bc3..c4fdad1 100644 --- a/src/engine/operations/helpers.ts +++ b/src/engine/operations/helpers.ts @@ -68,6 +68,6 @@ export function convertQ(q: Quantity, unit: Unit): Quantity { return qty(fromBase(toBase(q), unit), unit); } -function qty(value: Decimal, unit: Unit | null, repr?: string) { +function qty(value: Decimal, unit: Unit | null, repr?: "decimal" | "plain" | "fraction") { return { kind: "quantity" as const, value, unit, repr: repr ?? "decimal" }; } diff --git a/src/ui/editor.ts b/src/ui/editor.ts index 618e366..61111d0 100644 --- a/src/ui/editor.ts +++ b/src/ui/editor.ts @@ -257,8 +257,8 @@ export class SumEditor { }); this.resultsEl.addEventListener("click", (e) => { - const el = (e.target as HTMLElement).closest(".result-line"); - if (el?.dataset.value) {this.cb.onCopy(el.dataset.value);} + const el = (e.target as HTMLElement).closest(".result-line") as HTMLElement | null; + if (el?.dataset.value) {this.cb.onCopy(el.dataset.value as string);} }); }