UNPKG

react-async-iterators

Version:

The magic of JavaScript async iterators in React ⛓️ 🧬 🔃

14 lines (13 loc) 789 B
import { reactAsyncIterSpecialInfoSymbol, type ReactAsyncIterSpecialInfo } from '../common/ReactAsyncIterable.js'; import { type DeasyncIterized } from '../common/DeasyncIterized.js'; export { useAsyncIterMemo }; declare const useAsyncIterMemo: { <TRes, const TDeps extends React.DependencyList>(factory: (...depsWithWrappedAsyncIters: DepsWithReactAsyncItersWrapped<TDeps>) => TRes, deps: TDeps): TRes; <TRes>(factory: () => TRes, deps: []): TRes; }; type DepsWithReactAsyncItersWrapped<TDeps extends React.DependencyList> = { [I in keyof TDeps]: TDeps[I] extends { [Symbol.asyncIterator](): AsyncIterator<unknown>; [reactAsyncIterSpecialInfoSymbol]: ReactAsyncIterSpecialInfo<unknown, unknown>; } ? AsyncIterable<DeasyncIterized<TDeps[I]>> : TDeps[I]; };