@donverduyn/react-runtime
Version:
effect-ts react integration
22 lines (21 loc) • 1.87 kB
TypeScript
import React from 'react';
import type { useRuntimeProvider } from '@/hooks/useRuntimeProvider/useRuntimeProvider';
import type { ScopeId, ExtractStaticProps, IdProp, ResolvedProviderEntry, RegisterId, RuntimeKey, RuntimeInstance, ProviderApi, ProviderEntry, RuntimeApi, RuntimeApiFactory, RuntimeConfig, UpstreamProviderApi, ProviderId, RuntimeContext } from '@/types';
import type { PropService } from 'utils/effect';
export declare const useApiProxyFactory: <R>(runtimeApi: RuntimeApiFactory<R>, name: string) => (provider: ProviderEntry<R, any, unknown> & {
type: "runtime" | "upstream";
}, propsProxy: ProviderApi<R>["props"], collectFn: (module: RuntimeContext<any>) => Map<RuntimeKey, RuntimeInstance<any, any>>, factory?: (overrides?: Partial<RuntimeConfig>) => RuntimeApi<R> | undefined, options?: EntryBuilderOptions) => ProviderApi<R> | UpstreamProviderApi<any>;
export declare const usePropsProxyFactory: (name: string) => <P extends object>(currentProps: P) => P;
type EntryBuilderOptions = {
dryRun: boolean;
isolated: boolean;
stub: {
value: unknown;
} | undefined;
};
export declare const useEntryBuilder: <R, C extends React.FC<any>>(scopeId: ScopeId, name: string) => (providerEntries: ResolvedProviderEntry<R, C, unknown>[], currentUpstreamModuleMap: Map<ProviderId, Set<RuntimeContext<any, never, PropService>>> | null, initialProps: Record<string, unknown>, registerId: RegisterId, runtimeProvider: ReturnType<typeof useRuntimeProvider>, snapshot: ReturnType<ReturnType<typeof useRuntimeProvider>["getSnapshot"]> | null, options?: Partial<EntryBuilderOptions>) => {
resultProps: Partial<React.ComponentProps<C> & ExtractStaticProps<C>> & IdProp;
upstreamModuleSource: Map<ProviderId, Set<RuntimeContext<any, never, PropService>>>;
missingUpstream: Set<RuntimeContext<R, never, PropService>>;
};
export {};