From ea837b5d6af08ff58383e04bc2204d88ad309a09 Mon Sep 17 00:00:00 2001 From: Hunter Johnston Date: Fri, 20 Dec 2024 12:49:47 -0500 Subject: [PATCH] manual type --- .../useGeolocation/useGeolocation.svelte.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/runed/src/lib/utilities/useGeolocation/useGeolocation.svelte.ts b/packages/runed/src/lib/utilities/useGeolocation/useGeolocation.svelte.ts index 614fea91..184a59b9 100644 --- a/packages/runed/src/lib/utilities/useGeolocation/useGeolocation.svelte.ts +++ b/packages/runed/src/lib/utilities/useGeolocation/useGeolocation.svelte.ts @@ -18,12 +18,21 @@ type UseGeolocationPosition = WritableProperties>; }; +export type UseGeolocationReturn = { + readonly isSupported: boolean; + readonly position: UseGeolocationPosition; + readonly error: GeolocationPositionError | null; + readonly isPaused: boolean; + resume: () => void; + pause: () => void; +}; + /** * Reactive access to the browser's [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API). * * @see https://runed.dev/docs/utilities/use-geolocation */ -export function useGeolocation(options: UseGeolocationOptions = {}) { +export function useGeolocation(options: UseGeolocationOptions = {}): UseGeolocationReturn { const { enableHighAccuracy = true, maximumAge = 30000, @@ -89,9 +98,7 @@ export function useGeolocation(options: UseGeolocationOptions = {}) { get isSupported() { return isSupported; }, - get position() { - return position; - }, + position, get error() { return error; }, @@ -102,5 +109,3 @@ export function useGeolocation(options: UseGeolocationOptions = {}) { pause, }; } - -export type useGeolocationReturn = ReturnType;