mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
fix: Atom type extends Selector
Also deprecates `Molecule`
This commit is contained in:
parent
f44e3e135f
commit
a430cf63e5
1 changed files with 4 additions and 4 deletions
8
src/charm/src/index.d.ts
vendored
8
src/charm/src/index.d.ts
vendored
|
|
@ -9,11 +9,10 @@ declare namespace Charm {
|
||||||
* the state changes, all subscribers are notified.
|
* the state changes, all subscribers are notified.
|
||||||
*
|
*
|
||||||
* @param state The next state or a function that produces the next state.
|
* @param state The next state or a function that produces the next state.
|
||||||
* @returns The current state, if no arguments are provided.
|
* @returns The current state.
|
||||||
*/
|
*/
|
||||||
interface Atom<State> {
|
interface Atom<State> extends Selector<State> {
|
||||||
(): State;
|
(nextState: State | ((prevState: State) => State)): State;
|
||||||
(nextState: State | ((prevState: State) => State)): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -28,6 +27,7 @@ declare namespace Charm {
|
||||||
* A function that depends on one or more atoms and produces a value. Can be
|
* A function that depends on one or more atoms and produces a value. Can be
|
||||||
* used to derive state from atoms.
|
* used to derive state from atoms.
|
||||||
*
|
*
|
||||||
|
* @deprecated Use `Selector<T>` instead.
|
||||||
* @returns The current state.
|
* @returns The current state.
|
||||||
*/
|
*/
|
||||||
type Molecule<State> = Selector<State>;
|
type Molecule<State> = Selector<State>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue