Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 356 B view raw
1import type { Accessor } from 'solid-js'; 2 3export type MaybeAccessor<T> = T | Accessor<T>; 4 5export type MaybeAccessorValue<T extends MaybeAccessor<any>> = 6 T extends () => any ? ReturnType<T> : T; 7 8export const asAccessor = <A extends MaybeAccessor<unknown>>( 9 v: A 10): Accessor<MaybeAccessorValue<A>> => 11 typeof v === 'function' ? (v as any) : () => v;