local types = require(script.Parent.Parent.types) type Atom = types.Atom local useAtomState = require(script.Parent.useAtomState) local useSetAtom = require(script.Parent.useSetAtom) type UseAtom = ((atom: Atom) -> (State, useSetAtom.SetState)) & (( atom: Atom, selector: ((State) -> Result)? ) -> (State | Result, useSetAtom.SetState)) & ((atom: Atom, selector: (State) -> Result) -> (Result, useSetAtom.SetState)) local function useAtom(atom: Atom, selector: ((State) -> State)?): (State, useSetAtom.SetState) return useAtomState(atom, selector), useSetAtom(atom) end return useAtom :: UseAtom