import * as _latticexyz_recs from '@latticexyz/recs';
import { Schema, Component, Entity, ComponentValue, QueryFragment } from '@latticexyz/recs';
import { Observable } from 'rxjs';

declare function useComponentValue<S extends Schema>(component: Component<S>, entity: Entity | undefined, defaultValue: ComponentValue<S>): ComponentValue<S>;
declare function useComponentValue<S extends Schema>(component: Component<S>, entity: Entity | undefined): ComponentValue<S> | undefined;

/**
 * Returns all matching entities for a given entity query,
 * and triggers a re-render as new query results come in.
 *
 * @param fragments Query fragments to match against, executed from left to right.
 * @param options.updateOnValueChange False - re-renders only on entity array changes. True (default) - also on component value changes.
 * @returns Set of entities matching the query fragments.
 */
declare function useEntityQuery(fragments: QueryFragment[], options?: {
    updateOnValueChange?: boolean;
}): _latticexyz_recs.Entity[];

declare function useObservableValue<T>(observable: Observable<T>, defaultValue: T): T;
declare function useObservableValue<T>(observable: Observable<T>): T | undefined;

type UsePromiseResult<T> = PromiseSettledResult<Awaited<T>> | {
    status: "pending";
} | {
    status: "idle";
};
declare function usePromise<T>(promise: PromiseLike<T> | null | undefined): UsePromiseResult<T>;

export { UsePromiseResult, useComponentValue, useEntityQuery, useObservableValue, usePromise };
