UNPKG

@humanspeak/svelte-motion

Version:

Framer Motion for Svelte 5. Declarative motion.<tag> components with AnimatePresence exit animations, gestures (hover, tap, drag, focus, in-view), variants, FLIP layout animations, shared-layout transitions, spring physics, and scroll-linked motion values

29 lines (28 loc) 1.07 kB
/** * Returns true if the provided value appears to be Promise-like. * * A value is considered Promise-like if it is a non-null object that exposes a * callable `then` function. This conservative check avoids throwing on * primitives and is resilient to different Promise implementations. * * @param value Value to test. * @return Whether `value` is Promise-like. */ export declare const isPromiseLike: (value: unknown) => value is Promise<unknown>; /** Structure with an optional `finished` field compatible with Motion controls. */ export type WithFinished = { finished?: unknown; }; /** * Narrows to objects that expose a `finished` Promise. * * Motion's `animate` may return an object with a `finished` Promise, or a * then-able control. This helper provides a safe type-guard for the former. * * @typeParam T Input object type. * @param value Value to inspect. * @return Whether `value.finished` is a Promise. */ export declare const hasFinishedPromise: <T extends WithFinished>(value: T) => value is T & { finished: Promise<unknown>; };