From ddc6a54d84dd4e893cdc016043b2e2259587c6f1 Mon Sep 17 00:00:00 2001 From: Anthony Merlo Date: Sat, 22 Aug 2026 23:00:30 +0100 Subject: [PATCH] fix: import Notification from scripting, use HealthQuantityType type - Notification is not global, must import from 'scripting' - queryQuantitySamples expects HealthQuantityType not string --- scripts/health-sync.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)