diff --git a/scripts/health-sync.tsx b/scripts/health-sync.tsx index 7d4d4e9..23626cb 100644 --- a/scripts/health-sync.tsx +++ b/scripts/health-sync.tsx @@ -12,7 +12,7 @@ // // Docs: https://scriptingapp.github.io/guide/Device%20Capabilities/Health/ -import { Script } from "scripting" +import { Script, Notification } from "scripting" // Variables used by Scripting app. These must be at the very top of the file. // icon-color: deep-blue; icon-glyph: heart; @@ -30,7 +30,7 @@ const U = { } // Read the most recent sample of a type. Returns { value, startDate } or null. -async function readLatest(type: string, unit: HealthUnit): Promise<{ value: number; startDate: Date } | null> { +async function readLatest(type: HealthQuantityType, unit: HealthUnit): Promise<{ value: number; startDate: Date } | null> { try { const samples = await Health.queryQuantitySamples(type, { limit: 1, @@ -51,7 +51,7 @@ async function readLatest(type: string, unit: HealthUnit): Promise<{ value: numb } // Sum all samples of a type since midnight. Returns a number or null. -async function readTodaySum(type: string, unit: HealthUnit): Promise { +async function readTodaySum(type: HealthQuantityType, unit: HealthUnit): Promise { try { const start = new Date() start.setHours(0, 0, 0, 0)