Skip to content

SaveResult — @gj-kit/expo-workouts

A public type from @gj-kit/expo-workouts/core. The signature below is taken directly from the 0.1.1 release declaration.

import { SaveResult } from '@gj-kit/expo-workouts/core';
/**
* A discriminated union, so `nativeId` does not EXIST on the `pendingUnlock` branch. That branch
* only ever appears on a locked device, i.e. never during development, so a type that merely made
* `nativeId` optional would be forgotten by everyone.
*/
type SaveResult = {
readonly status: 'saved';
/** Echo of `WorkoutWrite.id`. */
readonly id: string;
/** The platform's own id for the stored workout. */
readonly nativeId: string;
readonly route: Exclude<RouteWriteOutcome, 'deferred'>;
/** How many points actually reached the store. Compare it against what you sent to see how
* much our mandatory hygiene removed. */
readonly routePointsWritten: number;
} | {
/**
* The store accepted the workout but cannot confirm it while the device is locked.
* **Do not re-save blindly.** Call `saveWorkout` again with the SAME `id` and `version` once
* the device is unlocked; that call is idempotent and completes the route.
*/
readonly status: 'pendingUnlock';
readonly id: string;
readonly route: 'deferred';
readonly routePointsWritten: 0;
};

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-workouts
  • Version: 0.1.1
  • Public entry: ./core
  • Source: GitHub