feat: add overload for nullable atoms

This commit is contained in:
Richard 2024-08-26 19:34:18 -07:00
parent 1906eb3b24
commit 5392fcd69b

3
src/index.d.ts vendored
View file

@ -69,6 +69,9 @@ declare namespace Charm {
*/
function atom<State>(state: State, options?: AtomOptions<State>): Atom<State>;
// Overload for no arguments
function atom<State>(state?: State, options?: AtomOptions<State>): Atom<State | undefined>;
/**
* Creates a read-only atom that derives its state from one or more atoms.
* Used to avoid unnecessary recomputations if multiple listeners depend on