import type { ViewOf } from "atom.io" import type { Canonical } from "atom.io/foundations/canonical" import { getFromStore, IMPLICIT } from "atom.io/internal" import type { ReadableFamilyToken, ReadableToken } from "." /** * Read or compute the current value of a state * @param token - The token of the state to get * @return The current value of the state * @overload Default * @default */ export function getState( token: ReadableToken, ): ViewOf /** * Read or compute the current value of a state * @param token - The token of a state family * @param key - The unique key of the state to get * @return The current value of the state * @overload Streamlined */ export function getState( token: ReadableFamilyToken, key: NoInfer, ): ViewOf export function getState( ...params: | [token: ReadableFamilyToken, key: NoInfer] | [token: ReadableToken] ): ViewOf { return getFromStore(IMPLICIT.STORE, ...params) }