Skip to content

Package @reatom/core

@reatom/core

Classes

ReatomError

Defined in: packages/core/src/core/atom.ts:352

Extends

  • Error

Constructors

Constructor

new ReatomError(message?): ReatomError

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1082

Parameters
message?

string

Returns

ReatomError

Inherited from

Error.constructor

Constructor

new ReatomError(message?, options?): ReatomError

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1082

Parameters
message?

string

options?

ErrorOptions

Returns

ReatomError

Inherited from

Error.constructor

Properties

cause?

optional cause: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name

stack?

optional stack: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.9.1/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

Error.stackTraceLimit

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.9.1/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

Error.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.9.1/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Interfaces

Action()<Params, Payload>

Defined in: packages/core/src/core/action.ts:23

Logic container with atom features

Extends

Type Parameters

Params

Params extends any[] = any[]

Payload

Payload = any

Action(…params): Payload

Defined in: packages/core/src/core/action.ts:23

Logic container with atom features

Parameters

params

Params

Parameters to pass to the atom

Returns

Payload

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: packages/core/src/core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<Action<Params, Payload>>

Defined in: packages/core/src/core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

extend

extend: Extend<Action<Params, Payload>>

Defined in: packages/core/src/core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

set

set: unknown

Defined in: packages/core/src/core/atom.ts:79

Inherited from

AtomLike.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: packages/core/src/core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe


ActionCall<Params, Payload>

Defined in: packages/core/src/core/action.ts:13

Type Parameters

Params

Params extends any[] = any[]

Payload

Payload = any

Properties

params

params: Params

Defined in: packages/core/src/core/action.ts:14

payload

payload: Payload

Defined in: packages/core/src/core/action.ts:15


ActionState<Params, Payload>

Defined in: packages/core/src/core/action.ts:19

Autoclearable array of processed events

Extends

Type Parameters

Params

Params extends any[] = any[]

Payload

Payload = any

Indexable

[n: number]: ActionCall<Params, Payload>

Properties

[unscopables]

readonly [unscopables]: object

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:97

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

Index Signature

[key: number]: undefined | boolean

[iterator]?

optional [iterator]: boolean

[unscopables]?

readonly optional [unscopables]: boolean

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

at?

optional at: boolean

concat?

optional concat: boolean

copyWithin?

optional copyWithin: boolean

entries?

optional entries: boolean

every?

optional every: boolean

fill?

optional fill: boolean

filter?

optional filter: boolean

find?

optional find: boolean

findIndex?

optional findIndex: boolean

findLast?

optional findLast: boolean

findLastIndex?

optional findLastIndex: boolean

flat?

optional flat: boolean

flatMap?

optional flatMap: boolean

forEach?

optional forEach: boolean

includes?

optional includes: boolean

indexOf?

optional indexOf: boolean

join?

optional join: boolean

keys?

optional keys: boolean

lastIndexOf?

optional lastIndexOf: boolean

length?

optional length: boolean

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

map?

optional map: boolean

pop?

optional pop: boolean

push?

optional push: boolean

reduce?

optional reduce: boolean

reduceRight?

optional reduceRight: boolean

reverse?

optional reverse: boolean

shift?

optional shift: boolean

slice?

optional slice: boolean

some?

optional some: boolean

sort?

optional sort: boolean

splice?

optional splice: boolean

toLocaleString?

optional toLocaleString: boolean

toReversed?

optional toReversed: boolean

toSorted?

optional toSorted: boolean

toSpliced?

optional toSpliced: boolean

toString?

optional toString: boolean

unshift?

optional unshift: boolean

values?

optional values: boolean

with?

optional with: boolean

Inherited from

Array.[unscopables]

length

length: number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1329

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

Inherited from

Array.length

Methods

[iterator]()

[iterator](): ArrayIterator<ActionCall<Params, Payload>>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:78

Iterator

Returns

ArrayIterator<ActionCall<Params, Payload>>

Inherited from

Array.[iterator]

at()

at(index): undefined | ActionCall<Params, Payload>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts:24

Returns the item located at the specified index.

Parameters
index

number

The zero-based index of the desired code unit. A negative index will count back from the last item.

Returns

undefined | ActionCall<Params, Payload>

Inherited from

Array.at

concat()
Call Signature

concat(…items): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1353

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

Parameters
items

ConcatArray<ActionCall<Params, Payload>>[]

Additional arrays and/or items to add to the end of the array.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.concat

Call Signature

concat(…items): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1359

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

Parameters
items

…(ActionCall<Params, Payload> | ConcatArray<ActionCall<Params, Payload>>)[]

Additional arrays and/or items to add to the end of the array.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.concat

copyWithin()

copyWithin(target, start, end?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:62

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Parameters
target

number

If target is negative, it is treated as length+target where length is the length of the array.

start

number

If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

end?

number

If not specified, length of the this object is used as its default value.

Returns

this

Inherited from

Array.copyWithin

entries()

entries(): ArrayIterator<[number, ActionCall<Params, Payload>]>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:83

Returns an iterable of key, value pairs for every entry in the array

Returns

ArrayIterator<[number, ActionCall<Params, Payload>]>

Inherited from

Array.entries

every()
Call Signature

every<S>(predicate, thisArg?): this is S[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1440

Determines whether all the members of an array satisfy the specified test.

Type Parameters
S

S extends ActionCall<Params, Payload>

Parameters
predicate

(value, index, array) => value is S

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

this is S[]

Inherited from

Array.every

Call Signature

every(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1449

Determines whether all the members of an array satisfy the specified test.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Array.every

fill()

fill(value, start?, end?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:51

Changes all array elements from start to end index to a static value and returns the modified array

Parameters
value

ActionCall

value to fill array section with

start?

number

index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

end?

number

index to stop filling the array at. If end is negative, it is treated as length+end.

Returns

this

Inherited from

Array.fill

filter()
Call Signature

filter<S>(predicate, thisArg?): S[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1476

Returns the elements of an array that meet the condition specified in a callback function.

Type Parameters
S

S extends ActionCall<Params, Payload>

Parameters
predicate

(value, index, array) => value is S

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

S[]

Inherited from

Array.filter

Call Signature

filter(predicate, thisArg?): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1482

Returns the elements of an array that meet the condition specified in a callback function.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.filter

find()
Call Signature

find<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:29

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Type Parameters
S

S extends ActionCall<Params, Payload>

Parameters
predicate

(value, index, obj) => value is S

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

undefined | S

Inherited from

Array.find

Call Signature

find(predicate, thisArg?): undefined | ActionCall<Params, Payload>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:30

Parameters
predicate

(value, index, obj) => unknown

thisArg?

any

Returns

undefined | ActionCall<Params, Payload>

Inherited from

Array.find

findIndex()

findIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:41

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Parameters
predicate

(value, index, obj) => unknown

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Array.findIndex

findLast()
Call Signature

findLast<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:29

Returns the value of the last element in the array where predicate is true, and undefined otherwise.

Type Parameters
S

S extends ActionCall<Params, Payload>

Parameters
predicate

(value, index, array) => value is S

findLast calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLast immediately returns that element value. Otherwise, findLast returns undefined.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

undefined | S

Inherited from

Array.findLast

Call Signature

findLast(predicate, thisArg?): undefined | ActionCall<Params, Payload>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:30

Parameters
predicate

(value, index, array) => unknown

thisArg?

any

Returns

undefined | ActionCall<Params, Payload>

Inherited from

Array.findLast

findLastIndex()

findLastIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:41

Returns the index of the last element in the array where predicate is true, and -1 otherwise.

Parameters
predicate

(value, index, array) => unknown

findLastIndex calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Array.findLastIndex

flat()

flat<A, D>(this, depth?): FlatArray<A, D>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts:75

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

Type Parameters
A

A

D

D extends number = 1

Parameters
this

A

depth?

D

The maximum recursion depth

Returns

FlatArray<A, D>[]

Inherited from

Array.flat

flatMap()

flatMap<U, This>(callback, thisArg?): U[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts:64

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

Type Parameters
U

U

This

This = undefined

Parameters
callback

(this, value, index, array) => U | readonly U[]

A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

thisArg?

This

An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

Returns

U[]

Inherited from

Array.flatMap

forEach()

forEach(callbackfn, thisArg?): void

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1464

Performs the specified action for each element in an array.

Parameters
callbackfn

(value, index, array) => void

A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

void

Inherited from

Array.forEach

includes()

includes(searchElement, fromIndex?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts:25

Determines whether an array includes a certain element, returning true or false as appropriate.

Parameters
searchElement

ActionCall

The element to search for.

fromIndex?

number

The position in this array at which to begin searching for searchElement.

Returns

boolean

Inherited from

Array.includes

indexOf()

indexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1425

Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

Parameters
searchElement

ActionCall

The value to locate in the array.

fromIndex?

number

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Array.indexOf

join()

join(separator?): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1364

Adds all the elements of an array into a string, separated by the specified separator string.

Parameters
separator?

string

A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

Returns

string

Inherited from

Array.join

keys()

keys(): ArrayIterator<number>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:88

Returns an iterable of keys in the array

Returns

ArrayIterator<number>

Inherited from

Array.keys

lastIndexOf()

lastIndexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1431

Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

Parameters
searchElement

ActionCall

The value to locate in the array.

fromIndex?

number

The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

Returns

number

Inherited from

Array.lastIndexOf

map()

map<U>(callbackfn, thisArg?): U[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1470

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Type Parameters
U

U

Parameters
callbackfn

(value, index, array) => U

A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

U[]

Inherited from

Array.map

pop()

pop(): undefined | ActionCall<Params, Payload>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1342

Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

Returns

undefined | ActionCall<Params, Payload>

Inherited from

Array.pop

push()

push(…items): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1347

Appends new elements to the end of an array, and returns the new length of the array.

Parameters
items

ActionCall<Params, Payload>[]

New elements to add to the array.

Returns

number

Inherited from

Array.push

reduce()
Call Signature

reduce(callbackfn): ActionCall

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1488

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => ActionCall

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

Returns

ActionCall

Inherited from

Array.reduce

Call Signature

reduce(callbackfn, initialValue): ActionCall

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1489

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => ActionCall

initialValue

ActionCall

Returns

ActionCall

Inherited from

Array.reduce

Call Signature

reduce<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1495

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters
U

U

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

initialValue

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Array.reduce

reduceRight()
Call Signature

reduceRight(callbackfn): ActionCall

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1501

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => ActionCall

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

Returns

ActionCall

Inherited from

Array.reduceRight

Call Signature

reduceRight(callbackfn, initialValue): ActionCall

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1502

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => ActionCall

initialValue

ActionCall

Returns

ActionCall

Inherited from

Array.reduceRight

Call Signature

reduceRight<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1508

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters
U

U

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Array.reduceRight

reverse()

reverse(): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1369

Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.reverse

shift()

shift(): undefined | ActionCall<Params, Payload>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1374

Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

Returns

undefined | ActionCall<Params, Payload>

Inherited from

Array.shift

slice()

slice(start?, end?): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1384

Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

Parameters
start?

number

The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

end?

number

The end index of the specified portion of the array. This is exclusive of the element at the index ‘end’. If end is undefined, then the slice extends to the end of the array.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.slice

some()

some(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1458

Determines whether the specified callback function returns true for any element of an array.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Array.some

sort()

sort(compareFn?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1395

Sorts an array in place. This method mutates the array and returns a reference to the same array.

Parameters
compareFn?

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11,2,22,1].sort((a, b) => a - b)
Returns

this

Inherited from

Array.sort

splice()
Call Signature

splice(start, deleteCount?): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1404

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount?

number

The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.

Returns

ActionCall<Params, Payload>[]

An array containing the elements that were deleted.

Inherited from

Array.splice

Call Signature

splice(start, deleteCount, …items): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1414

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount

number

The number of elements to remove. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.

items

ActionCall<Params, Payload>[]

Elements to insert into the array in place of the deleted elements.

Returns

ActionCall<Params, Payload>[]

An array containing the elements that were deleted.

Inherited from

Array.splice

toLocaleString()
Call Signature

toLocaleString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1337

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

Returns

string

Inherited from

Array.toLocaleString

Call Signature

toLocaleString(locales, options?): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:64

Parameters
locales

string | string[]

options?

NumberFormatOptions & DateTimeFormatOptions

Returns

string

Inherited from

Array.toLocaleString

toReversed()

toReversed(): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:46

Returns a copy of an array with its elements reversed.

Returns

ActionCall<Params, Payload>[]

Inherited from

Array.toReversed

toSorted()

toSorted(compareFn?): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:57

Returns a copy of an array with its elements sorted.

Parameters
compareFn?

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
Returns

ActionCall<Params, Payload>[]

Inherited from

Array.toSorted

toSpliced()
Call Signature

toSpliced(start, deleteCount, …items): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:66

Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount

number

The number of elements to remove.

items

ActionCall<Params, Payload>[]

Elements to insert into the copied array in place of the deleted elements.

Returns

ActionCall<Params, Payload>[]

The copied array.

Inherited from

Array.toSpliced

Call Signature

toSpliced(start, deleteCount?): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:74

Copies an array and removes elements while returning the remaining elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount?

number

The number of elements to remove.

Returns

ActionCall<Params, Payload>[]

A copy of the original array with the remaining elements.

Inherited from

Array.toSpliced

toString()

toString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1333

Returns a string representation of an array.

Returns

string

Inherited from

Array.toString

unshift()

unshift(…items): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1419

Inserts new elements at the start of an array, and returns the new length of the array.

Parameters
items

ActionCall<Params, Payload>[]

Elements to insert at the start of the array.

Returns

number

Inherited from

Array.unshift

values()

values(): ArrayIterator<ActionCall<Params, Payload>>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:93

Returns an iterable of values in the array

Returns

ArrayIterator<ActionCall<Params, Payload>>

Inherited from

Array.values

with()

with(index, value): ActionCall<Params, Payload>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:85

Copies an array, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the array.

Parameters
index

number

The index of the value to overwrite. If the index is negative, then it replaces from the end of the array.

value

ActionCall

The value to write into the copied array.

Returns

ActionCall<Params, Payload>[]

The copied array with the updated value.

Inherited from

Array.with


AssignerExt()<Methods, Target>

Defined in: packages/core/src/core/extend.ts:42

Extension that assigns additional methods to an atom/action.

This extension type is used for adding methods or properties to atoms or actions without modifying their core behavior.

Type Parameters

Methods

Methods extends Rec = { }

Record of methods/properties to be added to the target

Target

Target extends AtomLike = AtomLike

The type of atom or action the extension can be applied to

AssignerExt<T>(target): Methods

Defined in: packages/core/src/core/extend.ts:46

Extension that assigns additional methods to an atom/action.

This extension type is used for adding methods or properties to atoms or actions without modifying their core behavior.

Type Parameters

T

T extends AtomLike<any, any[], any>

Parameters

target

T

Returns

Methods


Atom()<State, Params>

Defined in: packages/core/src/core/atom.ts:118

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Extends

Extended by

Type Parameters

State

State = any

The type of state stored in the atom

Params

Params extends any[] = [State]

Atom(…params): State

Defined in: packages/core/src/core/atom.ts:118

Base changeable state container.

Atom is the core primitive for storing and updating mutable state in Reatom. It can be called to retrieve its current state or update it with a new value or update function.

Parameters

params

…[]

Parameters to pass to the atom

Returns

State

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: packages/core/src/core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<Atom<State, Params>>

Defined in: packages/core/src/core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

extend

extend: Extend<Atom<State, Params>>

Defined in: packages/core/src/core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: packages/core/src/core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe

Methods

set()
Call Signature

set(update): State

Defined in: packages/core/src/core/atom.ts:127

Update the atom’s state using a function that receives the previous state

Parameters
update

(state) => State

Function that takes the current state and returns a new state

Returns

State

The new state value

Overrides

AtomLike.set

Call Signature

set(…params): State

Defined in: packages/core/src/core/atom.ts:135

Set the atom’s state to a new value

Parameters
params

Params

Returns

State

The new state value

Overrides

AtomLike.set


AtomLike()<State, Params, Payload>

Defined in: packages/core/src/core/atom.ts:66

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Extended by

Type Parameters

State

State = any

The type of state stored in the atom

Params

Params extends any[] = any[]

Payload

Payload = State

The return type when the atom is called

AtomLike(…params): Payload

Defined in: packages/core/src/core/atom.ts:77

Base atom interface for other userspace implementations. This is the core interface that all atom-like objects implement, providing the foundation for Reatom’s reactivity system.

Parameters

params

Params

Parameters to pass to the atom

Returns

Payload

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: packages/core/src/core/atom.ts:106

Reference to the atom’s internal metadata.

actions

actions: Actions<AtomLike<State, Params, Payload>>

Defined in: packages/core/src/core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

extend

extend: Extend<AtomLike<State, Params, Payload>>

Defined in: packages/core/src/core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

set

set: unknown

Defined in: packages/core/src/core/atom.ts:79

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: packages/core/src/core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called


AtomMeta

Defined in: packages/core/src/core/atom.ts:21

Metadata associated with an atom instance that controls its behavior and lifecycle. This interface is used internally by the Reatom framework and should not be accessed directly in application code.

Properties

initState

readonly initState: any

Defined in: packages/core/src/core/atom.ts:29

The initial state of the atom.

middlewares

readonly middlewares: (next, …params) => any[]

Defined in: packages/core/src/core/atom.ts:35

Array of middleware functions that intercept and potentially transform atom operations.

Parameters
next

Fn

params

any[]

Returns

any

onConnect

onConnect: undefined | Action<any[], any> & AbortExt

Defined in: packages/core/src/core/atom.ts:55

Function called when the atom gains its first subscriber. onConnect.abort called when the atom loses its last subscriber.

reactive

readonly reactive: boolean

Defined in: packages/core/src/core/atom.ts:26

Indicates whether the atom is reactive. Set to false for actions or the context atom.


Computed()<State>

Defined in: packages/core/src/core/atom.ts:147

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Extends

Extended by

Type Parameters

State

State = any

The type of derived state

Computed(…params): State

Defined in: packages/core/src/core/atom.ts:147

Derived state container.

A computed atom automatically tracks dependencies and recalculates only when those dependencies change. The calculation is performed lazily, only when the computed value is read AND subscribed to.

Parameters

params

…[]

Parameters to pass to the atom

Returns

State

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: packages/core/src/core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<Computed<State>>

Defined in: packages/core/src/core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

extend

extend: Extend<Computed<State>>

Defined in: packages/core/src/core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

set

set: unknown

Defined in: packages/core/src/core/atom.ts:79

Inherited from

AtomLike.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: packages/core/src/core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe


ContextAtom()

Defined in: packages/core/src/core/atom.ts:301

Atom interface for the context atom. Provides methods to start new isolated contexts.

Extends

ContextAtom(…params): RootFrame

Defined in: packages/core/src/core/atom.ts:301

Atom interface for the context atom. Provides methods to start new isolated contexts.

Parameters

params

…[]

Parameters to pass to the atom

Returns

RootFrame

The atom’s payload (typically its current state)

Properties

__reatom

__reatom: AtomMeta

Defined in: packages/core/src/core/atom.ts:106

Reference to the atom’s internal metadata.

Inherited from

AtomLike.__reatom

actions

actions: Actions<ContextAtom>

Defined in: packages/core/src/core/atom.ts:86

Bind methods to the atom to extend its functionality.

Deprecated

Use extend instead

Inherited from

AtomLike.actions

extend

extend: Extend<ContextAtom>

Defined in: packages/core/src/core/atom.ts:92

Extension system to add capabilities to atoms. Allows adding middleware, methods, or other functionality to modify atom behavior.

Inherited from

AtomLike.extend

set

set: unknown

Defined in: packages/core/src/core/atom.ts:79

Inherited from

AtomLike.set

subscribe()

subscribe: (cb?) => Unsubscribe

Defined in: packages/core/src/core/atom.ts:103

Subscribe to state changes, with the first call happening immediately. When a subscriber is added, the callback is immediately invoked with the current state. After that, it’s called whenever the atom’s state changes.

Parameters
cb?

(state) => any

Callback function that receives the atom’s state when it changes

Returns

Unsubscribe

An unsubscribe function that removes the subscription when called

Inherited from

AtomLike.subscribe

Methods

reset()

reset(): void

Defined in: packages/core/src/core/atom.ts:349

Reset the context to throw away all accumulated states and related meta. Aborts wraped effects too. Useful for tests, storybook, user logout and so on.

Note that Reatom has clearStack and context.start to scope the context very strictly. reset is useful if you playing with the default global context.

Returns

void

Example
import { atom, context } from '@reatom/core'
import { describe, test, beforeEach, expect } from 'vitest'
import { counter, doubled } from './my-feature'
describe('My feature', () => {
// Useful in test cleanup when user code is not strictly scoped with `clearStack`
beforeEach(() => {
context.reset()
})
test('counter increments', () => {
counter.set(5)
expect(doubled()).toBe(10)
})
test('default counter', () => {
// State is reset between tests, so counter starts at 0
expect(doubled()).toBe(0)
})
})
start()
Call Signature

start<T>(cb): T

Defined in: packages/core/src/core/atom.ts:308

Start a new isolated context and run a callback within it.

Type Parameters
T

T

Parameters
cb

() => T

Function to execute in the new context

Returns

T

The result of the callback

Call Signature

start(): RootFrame

Defined in: packages/core/src/core/atom.ts:315

Start a new isolated context.

Returns

RootFrame

The new context frame


Ext()<Target, Extension>

Defined in: packages/core/src/core/extend.ts:16

Extension function interface for modifying atoms and actions.

Extensions are functions that take an atom/action as input and return either the same atom/action with modified behavior or an object with additional properties to be assigned to the atom/action.

Type Parameters

Target

Target extends AtomLike = AtomLike

The type of atom or action the extension can be applied to

Extension

Extension = Target

The type that will be returned after applying the extension

Ext(target): Extension

Defined in: packages/core/src/core/extend.ts:17

Extension function interface for modifying atoms and actions.

Extensions are functions that take an atom/action as input and return either the same atom/action with modified behavior or an object with additional properties to be assigned to the atom/action.

Parameters

target

Target

Returns

Extension


Extend()<This>

Defined in: packages/core/src/core/extend.ts:74

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters

This

This extends AtomLike

The atom or action type being extended

Call Signature

Extend<T1>(extension1): T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1

Defined in: packages/core/src/core/extend.ts:75

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

Parameters
extension1

Ext<This, T1>

Returns

T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1

Call Signature

Extend<T1, T2>(extension1, extension2): T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2

Defined in: packages/core/src/core/extend.ts:76

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

Returns

T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2

Call Signature

Extend<T1, T2, T3>(extension1, extension2, extension3): T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3

Defined in: packages/core/src/core/extend.ts:77

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

Returns

T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3

Call Signature

Extend<T1, T2, T3, T4>(extension1, extension2, extension3, extension4): T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4

Defined in: packages/core/src/core/extend.ts:78

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

Returns

T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4

Call Signature

Extend<T1, T2, T3, T4, T5>(extension1, extension2, extension3, extension4, extension5): T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, …[], any> ? T1<T1> : This & T1 & T2 & T3 & T4 & T5

Defined in: packages/core/src/core/extend.ts:79

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

Returns

T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, …[], any> ? T1<T1> : This & T1 & T2 & T3 & T4 & T5

Call Signature

Extend<T1, T2, T3, T4, T5, T6>(extension1, extension2, extension3, extension4, extension5, extension6): T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, …[], any> ? T2<T2> : … extends … ? … : … & T2 & T3 & T4 & T5 & T6

Defined in: packages/core/src/core/extend.ts:80

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

T6

T6

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

extension6

Ext<T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<…, …, …> ? T1<…> : … & … & T2 & T3 & T4 & T5, T6>

Returns

T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, …[], any> ? T2<T2> : … extends … ? … : … & T2 & T3 & T4 & T5 & T6

Call Signature

Extend<T1, T2, T3, T4, T5, T6, T7>(extension1, extension2, extension3, extension4, extension5, extension6, extension7): T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, …[], any> ? T3<T3> : … extends … ? … : … & T3 & T4 & T5 & T6 & T7

Defined in: packages/core/src/core/extend.ts:81

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

T6

T6

T7

T7

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

extension6

Ext<T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<…, …, …> ? T1<…> : … & … & T2 & T3 & T4 & T5, T6>

extension7

Ext<T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<…, …, …> ? T2<…> : … & … & T3 & T4 & T5 & T6, T7>

Returns

T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, …[], any> ? T3<T3> : … extends … ? … : … & T3 & T4 & T5 & T6 & T7

Call Signature

Extend<T1, T2, T3, T4, T5, T6, T7, T8>(extension1, extension2, extension3, extension4, extension5, extension6, extension7, extension8): T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, …[], any> ? T4<T4> : … extends … ? … : … & T4 & T5 & T6 & T7 & T8

Defined in: packages/core/src/core/extend.ts:82

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

T6

T6

T7

T7

T8

T8

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

extension6

Ext<T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<…, …, …> ? T1<…> : … & … & T2 & T3 & T4 & T5, T6>

extension7

Ext<T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<…, …, …> ? T2<…> : … & … & T3 & T4 & T5 & T6, T7>

extension8

Ext<T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<…, …, …> ? T3<…> : … & … & T4 & T5 & T6 & T7, T8>

Returns

T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, …[], any> ? T4<T4> : … extends … ? … : … & T4 & T5 & T6 & T7 & T8

Call Signature

Extend<T1, T2, T3, T4, T5, T6, T7, T8, T9>(extension1, extension2, extension3, extension4, extension5, extension6, extension7, extension8, extension9): T9 extends AtomLike<any, any[], any> ? T9<T9> : T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, …[], any> ? T5<T5> : … extends … ? … : … & T5 & T6 & T7 & T8 & T9

Defined in: packages/core/src/core/extend.ts:83

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

T6

T6

T7

T7

T8

T8

T9

T9

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

extension6

Ext<T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<…, …, …> ? T1<…> : … & … & T2 & T3 & T4 & T5, T6>

extension7

Ext<T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<…, …, …> ? T2<…> : … & … & T3 & T4 & T5 & T6, T7>

extension8

Ext<T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<…, …, …> ? T3<…> : … & … & T4 & T5 & T6 & T7, T8>

extension9

Ext<T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<…, …, …> ? T4<…> : … & … & T5 & T6 & T7 & T8, T9>

Returns

T9 extends AtomLike<any, any[], any> ? T9<T9> : T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, …[], any> ? T5<T5> : … extends … ? … : … & T5 & T6 & T7 & T8 & T9

Call Signature

Extend<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(extension1, extension2, extension3, extension4, extension5, extension6, extension7, extension8, extension9, extension10): T10 extends AtomLike<any, any[], any> ? T10<T10> : T9 extends AtomLike<any, any[], any> ? T9<T9> : T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, …[], any> ? T6<T6> : … extends … ? … : … & T6 & T7 & T8 & T9 & T10

Defined in: packages/core/src/core/extend.ts:84

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T1

T1

T2

T2

T3

T3

T4

T4

T5

T5

T6

T6

T7

T7

T8

T8

T9

T9

T10

T10

Parameters
extension1

Ext<This, T1>

extension2

Ext<T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1, T2>

extension3

Ext<T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2, T3>

extension4

Ext<T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3, T4>

extension5

Ext<T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<any, any[], any> ? T1<T1> : This & T1 & T2 & T3 & T4, T5>

extension6

Ext<T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<any, any[], any> ? T2<T2> : T1 extends AtomLike<…, …, …> ? T1<…> : … & … & T2 & T3 & T4 & T5, T6>

extension7

Ext<T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<any, any[], any> ? T3<T3> : T2 extends AtomLike<…, …, …> ? T2<…> : … & … & T3 & T4 & T5 & T6, T7>

extension8

Ext<T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<any, any[], any> ? T4<T4> : T3 extends AtomLike<…, …, …> ? T3<…> : … & … & T4 & T5 & T6 & T7, T8>

extension9

Ext<T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<any, any[], any> ? T5<T5> : T4 extends AtomLike<…, …, …> ? T4<…> : … & … & T5 & T6 & T7 & T8, T9>

extension10

Ext<T9 extends AtomLike<any, any[], any> ? T9<T9> : T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, any[], any> ? T6<T6> : T5 extends AtomLike<…, …, …> ? T5<…> : … & … & T6 & T7 & T8 & T9, T10>

Returns

T10 extends AtomLike<any, any[], any> ? T10<T10> : T9 extends AtomLike<any, any[], any> ? T9<T9> : T8 extends AtomLike<any, any[], any> ? T8<T8> : T7 extends AtomLike<any, any[], any> ? T7<T7> : T6 extends AtomLike<any, …[], any> ? T6<T6> : … extends … ? … : … & T6 & T7 & T8 & T9 & T10

Call Signature

Extend<T>(…extensions): object & AtomLike<unknown, unknown[], unknown>

Defined in: packages/core/src/core/extend.ts:85

Method signature for the extend functionality on atoms and actions.

This interface defines the overload signatures for the extend method, supporting different numbers of extensions with proper type inference.

Type Parameters
T

T extends Ext<AtomLike<any, any[], any>, AtomLike<any, any[], any> | Rec>[]

Parameters
extensions

T

Returns

object & AtomLike<unknown, unknown[], unknown>


Frame<State, Params, Payload>

Defined in: packages/core/src/core/atom.ts:160

Call stack snapshot for an atom or action execution.

Frames represent the execution context of an atom at a specific point in a call stack, tracking its current state, error status, and dependencies.

See

https://github.com/tc39/proposal-async-context

Extended by

Type Parameters

State

State = any

The state type of the atom

Params

Params extends any[] = any[]

The parameter types the atom accepts

Payload

Payload = State

The return type when the atom is called

Indexable

[key: `var#${string}`]: unknown

Properties

atom

readonly atom: AtomLike<State, Params, Payload>

Defined in: packages/core/src/core/atom.ts:174

Reference to the atom itself

error

error: null | { }

Defined in: packages/core/src/core/atom.ts:166

Error that occurred during atom evaluation, or null if successful

pubs

pubs: [null | Frame<any, any[], any>, ...dependencies: Frame<any, any[], any>[]]

Defined in: packages/core/src/core/atom.ts:181

Immutable list of dependencies. The first element is actualization flag and an imperative write cause. Subsequent elements are the atom’s dependencies.

root

readonly root: RootState

Defined in: packages/core/src/core/atom.ts:197

The root frame state with all meta information

state

state: State

Defined in: packages/core/src/core/atom.ts:169

Current state of the atom

subs

readonly subs: AtomLike<any, any[], any>[]

Defined in: packages/core/src/core/atom.ts:184

Array of atoms that depend on this atom (subscribers).

var#abort

var#abort: undefined | ReatomAbortController

Defined in: packages/core/src/core/atom.ts:171

Methods

run()

run<I, O>(fn, …params): O

Defined in: packages/core/src/core/atom.ts:194

Run the callback in this context. DO NOT USE directly, use wrap instead to preserve context correctly.

Type Parameters
I

I extends any[]

O

O

Parameters
fn

(…params) => O

Function to execute in this context

params

I

Parameters to pass to the function

Returns

O

The result of the function call


GenericExt()<Target>

Defined in: packages/core/src/core/extend.ts:29

Extension that preserves the exact type of the target atom/action.

This specialized extension type ensures that when applied to an atom or action, the complete original type information is preserved, including all generic parameters.

Type Parameters

Target

Target extends AtomLike = AtomLike

The type of atom or action the extension can be applied to

GenericExt<T>(target): T

Defined in: packages/core/src/core/extend.ts:30

Extension that preserves the exact type of the target atom/action.

This specialized extension type ensures that when applied to an atom or action, the complete original type information is preserved, including all generic parameters.

Type Parameters

T

T extends AtomLike<any, any[], any>

Parameters

target

T

Returns

T


ParamsExt()<Target, Params>

Defined in: packages/core/src/core/extend.ts:277

Extension for customizing parameter handling in atoms and actions.

This extension type allows transforming the parameters an atom or action accepts, enabling custom parameter parsing, validation, or transformation.

Type Parameters

Target

Target extends AtomLike = AtomLike

The atom or action type being extended

Params

Params extends any[] = any[]

The new parameter types the atom/action will accept

ParamsExt(target): Target extends Action<ActionParams, Payload> ? ActionParams extends [any] ? Action<Params, Payload> : object & Action<unknown[], unknown> : Target extends Atom<State, [State]> ? Atom<State, Params> : AtomLike<AtomState<Target>, [] | Params, AtomState<Target>> & { [K in string | number | symbol]: Target[K] }

Defined in: packages/core/src/core/extend.ts:281

Extension for customizing parameter handling in atoms and actions.

This extension type allows transforming the parameters an atom or action accepts, enabling custom parameter parsing, validation, or transformation.

Parameters

target

Target

Returns

Target extends Action<ActionParams, Payload> ? ActionParams extends [any] ? Action<Params, Payload> : object & Action<unknown[], unknown> : Target extends Atom<State, [State]> ? Atom<State, Params> : AtomLike<AtomState<Target>, [] | Params, AtomState<Target>> & { [K in string | number | symbol]: Target[K] }


Queue

Defined in: packages/core/src/core/atom.ts:211

Task queue for scheduled operations.

Extends

  • Array<Fn>

Indexable

[n: number]: Fn

Properties

[unscopables]

readonly [unscopables]: object

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:97

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

Index Signature

[key: number]: undefined | boolean

[iterator]?

optional [iterator]: boolean

[unscopables]?

readonly optional [unscopables]: boolean

Is an object whose properties have the value ‘true’ when they will be absent when used in a ‘with’ statement.

at?

optional at: boolean

concat?

optional concat: boolean

copyWithin?

optional copyWithin: boolean

entries?

optional entries: boolean

every?

optional every: boolean

fill?

optional fill: boolean

filter?

optional filter: boolean

find?

optional find: boolean

findIndex?

optional findIndex: boolean

findLast?

optional findLast: boolean

findLastIndex?

optional findLastIndex: boolean

flat?

optional flat: boolean

flatMap?

optional flatMap: boolean

forEach?

optional forEach: boolean

includes?

optional includes: boolean

indexOf?

optional indexOf: boolean

join?

optional join: boolean

keys?

optional keys: boolean

lastIndexOf?

optional lastIndexOf: boolean

length?

optional length: boolean

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

map?

optional map: boolean

pop?

optional pop: boolean

push?

optional push: boolean

reduce?

optional reduce: boolean

reduceRight?

optional reduceRight: boolean

reverse?

optional reverse: boolean

shift?

optional shift: boolean

slice?

optional slice: boolean

some?

optional some: boolean

sort?

optional sort: boolean

splice?

optional splice: boolean

toLocaleString?

optional toLocaleString: boolean

toReversed?

optional toReversed: boolean

toSorted?

optional toSorted: boolean

toSpliced?

optional toSpliced: boolean

toString?

optional toString: boolean

unshift?

optional unshift: boolean

values?

optional values: boolean

with?

optional with: boolean

Inherited from

Array.[unscopables]

length

length: number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1329

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

Inherited from

Array.length

Methods

[iterator]()

[iterator](): ArrayIterator<Fn>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:78

Iterator

Returns

ArrayIterator<Fn>

Inherited from

Array.[iterator]

at()

at(index): undefined | Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts:24

Returns the item located at the specified index.

Parameters
index

number

The zero-based index of the desired code unit. A negative index will count back from the last item.

Returns

undefined | Fn

Inherited from

Array.at

concat()
Call Signature

concat(…items): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1353

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

Parameters
items

ConcatArray<Fn>[]

Additional arrays and/or items to add to the end of the array.

Returns

Fn[]

Inherited from

Array.concat

Call Signature

concat(…items): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1359

Combines two or more arrays. This method returns a new array without modifying any existing arrays.

Parameters
items

…(Fn | ConcatArray<Fn>)[]

Additional arrays and/or items to add to the end of the array.

Returns

Fn[]

Inherited from

Array.concat

copyWithin()

copyWithin(target, start, end?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:62

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Parameters
target

number

If target is negative, it is treated as length+target where length is the length of the array.

start

number

If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

end?

number

If not specified, length of the this object is used as its default value.

Returns

this

Inherited from

Array.copyWithin

entries()

entries(): ArrayIterator<[number, Fn]>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:83

Returns an iterable of key, value pairs for every entry in the array

Returns

ArrayIterator<[number, Fn]>

Inherited from

Array.entries

every()
Call Signature

every<S>(predicate, thisArg?): this is S[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1440

Determines whether all the members of an array satisfy the specified test.

Type Parameters
S

S extends Fn

Parameters
predicate

(value, index, array) => value is S

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

this is S[]

Inherited from

Array.every

Call Signature

every(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1449

Determines whether all the members of an array satisfy the specified test.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Array.every

fill()

fill(value, start?, end?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:51

Changes all array elements from start to end index to a static value and returns the modified array

Parameters
value

Fn

value to fill array section with

start?

number

index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

end?

number

index to stop filling the array at. If end is negative, it is treated as length+end.

Returns

this

Inherited from

Array.fill

filter()
Call Signature

filter<S>(predicate, thisArg?): S[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1476

Returns the elements of an array that meet the condition specified in a callback function.

Type Parameters
S

S extends Fn

Parameters
predicate

(value, index, array) => value is S

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

S[]

Inherited from

Array.filter

Call Signature

filter(predicate, thisArg?): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1482

Returns the elements of an array that meet the condition specified in a callback function.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

Fn[]

Inherited from

Array.filter

find()
Call Signature

find<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:29

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Type Parameters
S

S extends Fn

Parameters
predicate

(value, index, obj) => value is S

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

undefined | S

Inherited from

Array.find

Call Signature

find(predicate, thisArg?): undefined | Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:30

Parameters
predicate

(value, index, obj) => unknown

thisArg?

any

Returns

undefined | Fn

Inherited from

Array.find

findIndex()

findIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:41

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Parameters
predicate

(value, index, obj) => unknown

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Array.findIndex

findLast()
Call Signature

findLast<S>(predicate, thisArg?): undefined | S

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:29

Returns the value of the last element in the array where predicate is true, and undefined otherwise.

Type Parameters
S

S extends Fn

Parameters
predicate

(value, index, array) => value is S

findLast calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLast immediately returns that element value. Otherwise, findLast returns undefined.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

undefined | S

Inherited from

Array.findLast

Call Signature

findLast(predicate, thisArg?): undefined | Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:30

Parameters
predicate

(value, index, array) => unknown

thisArg?

any

Returns

undefined | Fn

Inherited from

Array.findLast

findLastIndex()

findLastIndex(predicate, thisArg?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:41

Returns the index of the last element in the array where predicate is true, and -1 otherwise.

Parameters
predicate

(value, index, array) => unknown

findLastIndex calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.

thisArg?

any

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Returns

number

Inherited from

Array.findLastIndex

flat()

flat<A, D>(this, depth?): FlatArray<A, D>[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts:75

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

Type Parameters
A

A

D

D extends number = 1

Parameters
this

A

depth?

D

The maximum recursion depth

Returns

FlatArray<A, D>[]

Inherited from

Array.flat

flatMap()

flatMap<U, This>(callback, thisArg?): U[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts:64

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

Type Parameters
U

U

This

This = undefined

Parameters
callback

(this, value, index, array) => U | readonly U[]

A function that accepts up to three arguments. The flatMap method calls the callback function one time for each element in the array.

thisArg?

This

An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.

Returns

U[]

Inherited from

Array.flatMap

forEach()

forEach(callbackfn, thisArg?): void

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1464

Performs the specified action for each element in an array.

Parameters
callbackfn

(value, index, array) => void

A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

void

Inherited from

Array.forEach

includes()

includes(searchElement, fromIndex?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts:25

Determines whether an array includes a certain element, returning true or false as appropriate.

Parameters
searchElement

Fn

The element to search for.

fromIndex?

number

The position in this array at which to begin searching for searchElement.

Returns

boolean

Inherited from

Array.includes

indexOf()

indexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1425

Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

Parameters
searchElement

Fn

The value to locate in the array.

fromIndex?

number

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

Returns

number

Inherited from

Array.indexOf

join()

join(separator?): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1364

Adds all the elements of an array into a string, separated by the specified separator string.

Parameters
separator?

string

A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

Returns

string

Inherited from

Array.join

keys()

keys(): ArrayIterator<number>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:88

Returns an iterable of keys in the array

Returns

ArrayIterator<number>

Inherited from

Array.keys

lastIndexOf()

lastIndexOf(searchElement, fromIndex?): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1431

Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

Parameters
searchElement

Fn

The value to locate in the array.

fromIndex?

number

The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

Returns

number

Inherited from

Array.lastIndexOf

map()

map<U>(callbackfn, thisArg?): U[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1470

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Type Parameters
U

U

Parameters
callbackfn

(value, index, array) => U

A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

thisArg?

any

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Returns

U[]

Inherited from

Array.map

pop()

pop(): undefined | Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1342

Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

Returns

undefined | Fn

Inherited from

Array.pop

push()

push(…items): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1347

Appends new elements to the end of an array, and returns the new length of the array.

Parameters
items

Fn[]

New elements to add to the array.

Returns

number

Inherited from

Array.push

reduce()
Call Signature

reduce(callbackfn): Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1488

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => Fn

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

Returns

Fn

Inherited from

Array.reduce

Call Signature

reduce(callbackfn, initialValue): Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1489

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => Fn

initialValue

Fn

Returns

Fn

Inherited from

Array.reduce

Call Signature

reduce<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1495

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters
U

U

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

initialValue

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Array.reduce

reduceRight()
Call Signature

reduceRight(callbackfn): Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1501

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => Fn

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

Returns

Fn

Inherited from

Array.reduceRight

Call Signature

reduceRight(callbackfn, initialValue): Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1502

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => Fn

initialValue

Fn

Returns

Fn

Inherited from

Array.reduceRight

Call Signature

reduceRight<U>(callbackfn, initialValue): U

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1508

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Type Parameters
U

U

Parameters
callbackfn

(previousValue, currentValue, currentIndex, array) => U

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue

U

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Returns

U

Inherited from

Array.reduceRight

reverse()

reverse(): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1369

Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array.

Returns

Fn[]

Inherited from

Array.reverse

shift()

shift(): undefined | Fn

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1374

Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

Returns

undefined | Fn

Inherited from

Array.shift

slice()

slice(start?, end?): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1384

Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array.

Parameters
start?

number

The beginning index of the specified portion of the array. If start is undefined, then the slice begins at index 0.

end?

number

The end index of the specified portion of the array. This is exclusive of the element at the index ‘end’. If end is undefined, then the slice extends to the end of the array.

Returns

Fn[]

Inherited from

Array.slice

some()

some(predicate, thisArg?): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1458

Determines whether the specified callback function returns true for any element of an array.

Parameters
predicate

(value, index, array) => unknown

A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

thisArg?

any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Returns

boolean

Inherited from

Array.some

sort()

sort(compareFn?): this

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1395

Sorts an array in place. This method mutates the array and returns a reference to the same array.

Parameters
compareFn?

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11,2,22,1].sort((a, b) => a - b)
Returns

this

Inherited from

Array.sort

splice()
Call Signature

splice(start, deleteCount?): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1404

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount?

number

The number of elements to remove. Omitting this argument will remove all elements from the start paramater location to end of the array. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.

Returns

Fn[]

An array containing the elements that were deleted.

Inherited from

Array.splice

Call Signature

splice(start, deleteCount, …items): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1414

Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount

number

The number of elements to remove. If value of this argument is either a negative number, zero, undefined, or a type that cannot be converted to an integer, the function will evaluate the argument as zero and not remove any elements.

items

Fn[]

Elements to insert into the array in place of the deleted elements.

Returns

Fn[]

An array containing the elements that were deleted.

Inherited from

Array.splice

toLocaleString()
Call Signature

toLocaleString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1337

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

Returns

string

Inherited from

Array.toLocaleString

Call Signature

toLocaleString(locales, options?): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts:64

Parameters
locales

string | string[]

options?

NumberFormatOptions & DateTimeFormatOptions

Returns

string

Inherited from

Array.toLocaleString

toReversed()

toReversed(): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:46

Returns a copy of an array with its elements reversed.

Returns

Fn[]

Inherited from

Array.toReversed

toSorted()

toSorted(compareFn?): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:57

Returns a copy of an array with its elements sorted.

Parameters
compareFn?

(a, b) => number

Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they’re equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.

[11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
Returns

Fn[]

Inherited from

Array.toSorted

toSpliced()
Call Signature

toSpliced(start, deleteCount, …items): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:66

Copies an array and removes elements and, if necessary, inserts new elements in their place. Returns the copied array.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount

number

The number of elements to remove.

items

Fn[]

Elements to insert into the copied array in place of the deleted elements.

Returns

Fn[]

The copied array.

Inherited from

Array.toSpliced

Call Signature

toSpliced(start, deleteCount?): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:74

Copies an array and removes elements while returning the remaining elements.

Parameters
start

number

The zero-based location in the array from which to start removing elements.

deleteCount?

number

The number of elements to remove.

Returns

Fn[]

A copy of the original array with the remaining elements.

Inherited from

Array.toSpliced

toString()

toString(): string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1333

Returns a string representation of an array.

Returns

string

Inherited from

Array.toString

unshift()

unshift(…items): number

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1419

Inserts new elements at the start of an array, and returns the new length of the array.

Parameters
items

Fn[]

Elements to insert at the start of the array.

Returns

number

Inherited from

Array.unshift

values()

values(): ArrayIterator<Fn>

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts:93

Returns an iterable of values in the array

Returns

ArrayIterator<Fn>

Inherited from

Array.values

with()

with(index, value): Fn[]

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts:85

Copies an array, then overwrites the value at the provided index with the given value. If the index is negative, then it replaces from the end of the array.

Parameters
index

number

The index of the value to overwrite. If the index is negative, then it replaces from the end of the array.

value

Fn

The value to write into the copied array.

Returns

Fn[]

The copied array with the updated value.

Inherited from

Array.with


RootFrame

Defined in: packages/core/src/core/atom.ts:295

Special frame type for the context atom.

Extends

Indexable

[key: `var#${string}`]: unknown

Properties

atom

readonly atom: AtomLike<RootState, [], RootState>

Defined in: packages/core/src/core/atom.ts:174

Reference to the atom itself

Inherited from

Frame.atom

error

error: null | { }

Defined in: packages/core/src/core/atom.ts:166

Error that occurred during atom evaluation, or null if successful

Inherited from

Frame.error

pubs

pubs: [null | Frame<any, any[], any>, ...dependencies: Frame<any, any[], any>[]]

Defined in: packages/core/src/core/atom.ts:181

Immutable list of dependencies. The first element is actualization flag and an imperative write cause. Subsequent elements are the atom’s dependencies.

Inherited from

Frame.pubs

root

readonly root: RootState

Defined in: packages/core/src/core/atom.ts:197

The root frame state with all meta information

Inherited from

Frame.root

state

state: RootState

Defined in: packages/core/src/core/atom.ts:169

Current state of the atom

Inherited from

Frame.state

subs

readonly subs: AtomLike<any, any[], any>[]

Defined in: packages/core/src/core/atom.ts:184

Array of atoms that depend on this atom (subscribers).

Inherited from

Frame.subs

var#abort

var#abort: undefined | ReatomAbortController

Defined in: packages/core/src/core/atom.ts:171

Inherited from

Frame.var#abort

Methods

run()

run<I, O>(fn, …params): O

Defined in: packages/core/src/core/atom.ts:194

Run the callback in this context. DO NOT USE directly, use wrap instead to preserve context correctly.

Type Parameters
I

I extends any[]

O

O

Parameters
fn

(…params) => O

Function to execute in this context

params

I

Parameters to pass to the function

Returns

O

The result of the function call

Inherited from

Frame.run


RootState

Defined in: packages/core/src/core/atom.ts:249

Reatom’s execution context that manages reactive state.

The context handles tracking relationships between atoms, scheduling operations, and maintaining the execution stack during Reatom operations.

Properties

cleanup

cleanup: Queue

Defined in: packages/core/src/core/atom.ts:273

Queue for cleanup callbacks to be executed.

compute

compute: Queue

Defined in: packages/core/src/core/atom.ts:270

Queue for computation callbacks to be executed.

effect

effect: Queue

Defined in: packages/core/src/core/atom.ts:276

Queue for effect callbacks to be executed.

frame

frame: RootFrame

Defined in: packages/core/src/core/atom.ts:291

Link to itself frame for internal use

frames

frames: WeakMap<AtomLike<any, any[], any>, { next: Frame; prev: null | Frame<any, any[], any>; }>

Defined in: packages/core/src/core/atom.ts:256

Frame history.

hook

hook: Queue

Defined in: packages/core/src/core/atom.ts:267

Queue for hook callbacks to be executed.

inits

inits: WeakMap<WeakKey, any>

Defined in: packages/core/src/core/atom.ts:259

Initialization flags for init hooks.

memoKey

memoKey: WeakMap<AtomLike<any, any[], any>, Rec>

Defined in: packages/core/src/core/atom.ts:262

Cache for in atom keyed memoization.

store

store: Store

Defined in: packages/core/src/core/atom.ts:251

Store that maps atoms to their frames in this context.

Methods

pushQueue()

pushQueue(cb, queue): void

Defined in: packages/core/src/core/atom.ts:286

Add a callback to a specific queue for later execution.

Parameters
cb

Fn

Callback function to schedule

queue

Queue to add the callback to

"hook" | "compute" | "cleanup" | "effect"

Returns

void


Store

Defined in: packages/core/src/core/atom.ts:219

Atom’s state mappings for context.

The Store maps atoms to their frames in the current context, allowing atoms to retrieve their state and dependencies.

Extends

Properties

[toStringTag]

readonly [toStringTag]: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:141

Inherited from

WeakMap.[toStringTag]

Methods

delete()

delete(key): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:67

Removes the specified element from the WeakMap.

Parameters
key

AtomLike

Returns

boolean

true if the element was successfully removed, or false if it was not present.

Inherited from

WeakMap.delete

get()

get<State, Params, Payload>(target): undefined | Frame<State, Params, Payload>

Defined in: packages/core/src/core/atom.ts:226

Get the frame for an atom in the current context.

Type Parameters
State

State

Params

Params extends any[]

Payload

Payload

Parameters
target

AtomLike<State, Params, Payload>

The atom to get the frame for

Returns

undefined | Frame<State, Params, Payload>

The frame for the atom, or undefined if not found

Overrides

WeakMap.get

has()

has(key): boolean

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:75

Parameters
key

AtomLike

Returns

boolean

a boolean indicating whether an element with the specified key exists or not.

Inherited from

WeakMap.has

set()

set<State, Params, Payload>(target, frame): this

Defined in: packages/core/src/core/atom.ts:237

Set the frame for an atom in the current context.

Type Parameters
State

State

Params

Params extends any[]

Payload

Payload

Parameters
target

AtomLike<State, Params, Payload>

The atom to set the frame for

frame

Frame<State, Params, Payload>

The frame to associate with the atom

Returns

this

This store instance

Overrides

WeakMap.set

Type Aliases

Actions()<Target>

Actions<Target> = {<Methods>(create): Target & ActionsExt<Methods>; <Methods>(methods): Target & ActionsExt<Methods>; }

Defined in: packages/core/src/core/actions.ts:31

Binding function type to add methods to an atom or action.

Accepts either a record of methods or a function that creates methods given the target atom/action, and returns the target extended with those methods converted to actions.

Type Parameters

Target

Target extends AtomLike

The atom or action being extended

Call Signature

<Methods>(create): Target & ActionsExt<Methods>

Add methods created by a factory function that receives the target

Type Parameters
Methods

Methods extends Rec<Fn>

Parameters
create

(target) => Methods

Function that receives the target and returns methods to add

Returns

Target & ActionsExt<Methods>

The target with the methods added as actions

Call Signature

<Methods>(methods): Target & ActionsExt<Methods>

Add a record of methods directly to the target

Type Parameters
Methods

Methods extends Rec<Fn>

Parameters
methods

Methods

Record of methods to add

Returns

Target & ActionsExt<Methods>

The target with the methods added as actions


ActionsExt<Methods>

ActionsExt<Methods> = { [K in keyof Methods]: Methods[K] extends (params: infer Params) => infer Payload ? Action<Params, Payload> : never }

Defined in: packages/core/src/core/actions.ts:13

Type representing a set of methods converted to Reatom actions.

This type maps each method in the original record to a corresponding Reatom action with the same parameter and return types.

Type Parameters

Methods

Methods extends Rec<Fn>

Record of functions to be converted to actions


AtomState<T>

AtomState<T> = T extends AtomLike<infer State, any, any> ? State : never

Defined in: packages/core/src/core/atom.ts:207

Helper type to extract the state type from an atom-like object.

Type Parameters

T

T

The atom-like type to extract the state from


GenericAction<T>

GenericAction<T> = T & Action<Parameters<T>, ReturnType<T>>

Defined in: packages/core/src/core/action.ts:26

Type Parameters

T

T extends Fn


Merge<Target, Extensions>

Merge<Target, Extensions> = Extensions extends [] ? Target : Extensions extends [infer E, ...(infer Rest extends any[])] ? Merge<E extends AtomLike ? E : Target & E, Rest> : never

Defined in: packages/core/src/core/extend.ts:57

Helper type for merging an atom/action with a series of extensions.

This type recursively merges a target with each extension in an array.

Type Parameters

Target

Target extends AtomLike

The base atom or action type

Extensions

Extensions extends any[]

Array of extension results to merge with the target


Middleware()<Target>

Middleware<Target> = (next, …params) => AtomState<Target>

Defined in: packages/core/src/core/extend.ts:152

Type representing a middleware function for atoms and actions.

Middleware functions intercept atom/action calls, allowing for custom behavior to be applied before or after the normal execution. They receive the next middleware function in the chain and the parameters passed to the atom/action.

Type Parameters

Target

Target extends AtomLike = AtomLike

The atom or action type the middleware applies to

Parameters

next

(…params) => AtomState<Target>

The next middleware function in the chain or the original atom/action handler

params

OverloadParameters<Target>

The parameters passed to the atom/action

Returns

AtomState<Target>

The state resulting from the atom/action execution


QueueKind

QueueKind = "hook" | "compute" | "cleanup" | "effect"

Defined in: packages/core/src/core/queues.ts:5

Variables

action()

action: {<Params, Payload>(cb, name?): Action<Params, Payload>; <Param, Payload>(cb, name?): Action<[Param?], Payload>; <T>(cb, name?): GenericAction<T>; }

Defined in: packages/core/src/core/action.ts:83

Creates a logic and side effect container.

Actions are used to encapsulate complex logic, perform side effects (like API calls), and orchestrate multiple state updates. Unlike atoms, actions are meant to be called with parameters and can return values.

Actions also have atom-like features (subscribe, extend) and track their call history.

Call Signature

<Params, Payload>(cb, name?): Action<Params, Payload>

Type Parameters
Params

Params extends any[] = any[]

Payload

Payload = any

Parameters
cb

(…params) => Payload

name?

string

Returns

Action<Params, Payload>

Call Signature

<Param, Payload>(cb, name?): Action<[Param?], Payload>

Type Parameters
Param

Param

Payload

Payload = any

Parameters
cb

() => Payload | (param?) => Payload

name?

string

Returns

Action<[Param?], Payload>

Call Signature

<T>(cb, name?): GenericAction<T>

Type Parameters
T

T extends Fn

Parameters
cb

T

name?

string

Returns

GenericAction<T>

Example

// Create an action that fetches data and updates state
const fetchUserData = action(async (userId: string) => {
const response = await wrap(fetch(`/api/users/${userId}`))
const data = await wrap(response.json())
// Update state atoms with the fetched data
userName(data.name)
userEmail(data.email)
return data // Actions can return values
}, 'fetchUserData')
// Call the action
fetchUserData('user123')

Template

The parameter types the action accepts

Template

The return type of the action

Param

The function containing the action’s logic

Param

Optional name for debugging purposes

Returns

An action instance that can be called with the specified parameters


ANONYMOUS

ANONYMOUS: boolean = false

Defined in: packages/core/src/core/atom.ts:759


atom()

atom: {<T>(): Atom<undefined | T>; <T>(createState, name?): Atom<T>; <T>(initState, name?): Atom<T>; }

Defined in: packages/core/src/core/atom.ts:974

Creates a mutable state container.

The atom is the core primitive for storing and updating mutable state in Reatom. Atoms can be called as functions to read their current value or to update the value.

Call Signature

<T>(): Atom<undefined | T>

Type Parameters
T

T

Returns

Atom<undefined | T>

Call Signature

<T>(createState, name?): Atom<T>

Type Parameters
T

T

Parameters
createState

() => T

name?

string

Returns

Atom<T>

Call Signature

<T>(initState, name?): Atom<T>

Type Parameters
T

T

Parameters
initState

T

name?

string

Returns

Atom<T>

Example

// Create with initial value
const counter = atom(0, 'counter')
// Read current value
const value = counter() // -> 0
// Update with new value
counter.set(5) // Sets value to 5
// Update with a function
counter.set((prev) => prev + 1) // Sets value to 6

Template

The type of state stored in the atom

Param

A function that returns the initial state, or the initial state value directly

Param

Optional name for the atom (useful for debugging)

Returns

An atom instance containing the state


context

context: ContextAtom

Defined in: packages/core/src/core/atom.ts:1041

Core context object that manages the reactive state context in Reatom.

The context is responsible for tracking dependencies between atoms, managing computation stacks, and ensuring proper reactivity. It serves as the foundation for Reatom’s reactivity system and provides access to the current context frame.

Returns

The current context frame

Throws

If called outside a valid context (broken async stack)


createAtom()

createAtom: {<State>(setup, name?): Atom<State>; <State>(setup, name?): Atom<State>; }

Defined in: packages/core/src/core/atom.ts:774

Call Signature

<State>(setup, name?): Atom<State>

Type Parameters
State

State

Parameters
setup
computed

(prev) => State

initState

State | () => State

name?

string

Returns

Atom<State>

Call Signature

<State>(setup, name?): Atom<State>

Type Parameters
State

State

Parameters
setup
computed?

() => State | (state?) => State

initState?

State | () => State

name?

string

Returns

Atom<State>


EXTENSIONS

EXTENSIONS: Ext[]

Defined in: packages/core/src/core/atom.ts:579


named()

named: {<T>(name): `${T}#${number}`; (name, suffix): string; (name, suffix?): string; }

Defined in: packages/core/src/core/atom.ts:564

Call Signature

<T>(name): `${T}#${number}`

Type Parameters
T

T extends string

Parameters
name

T

Returns

`${T}#${number}`

Call Signature

(name, suffix): string

Parameters
name

string

suffix

string

Returns

string

Call Signature

(name, suffix?): string

Parameters
name

string | TemplateStringsArray

suffix?

string

Returns

string


STACK

STACK: Frame[] = []

Defined in: packages/core/src/core/atom.ts:1131


withMiddleware()

withMiddleware: {<Target>(cb, tail?): GenericExt<Target>; <Target, Result>(cb, tail?): Ext<Target, Result>; }

Defined in: packages/core/src/core/extend.ts:195

Creates an extension that adds middleware to an atom or action.

Middleware allows intercepting and modifying the execution flow of atoms and actions. This is the fundamental mechanism for creating behavior extensions in Reatom.

Call Signature

<Target>(cb, tail?): GenericExt<Target>

Type Parameters
Target

Target extends AtomLike<any, any[], any>

Parameters
cb

(target) => Middleware<Target>

tail?

boolean

Returns

GenericExt<Target>

Call Signature

<Target, Result>(cb, tail?): Ext<Target, Result>

Type Parameters
Target

Target extends AtomLike<any, any[], any>

Result

Result extends AtomLike<any, any[], any> = Target

Parameters
cb

(target) => Middleware<Target>

tail?

boolean

Returns

Ext<Target, Result>

Example

// Creating a logging middleware extension
const withLogger = (prefix: string) =>
withMiddleware((target) => {
return (next, ...params) => {
console.log(`${prefix} [${target.name}] Before:`, params)
const result = next(...params)
console.log(`${prefix} [${target.name}] After:`, result)
return result
}
})
// Using the middleware
const counter = atom(0).extend(withLogger('DEBUG'))

Template

The type of atom or action the middleware will be applied to

Template

The resulting type after applying the middleware

Param

A function that receives the target and returns a middleware function

Param

Whether to add the middleware at the end (true) or the beginning (false) of the middleware chain. IMPORTANT: false allows the middleware to be called inside the default “computed” middleware, which means all other atoms read are reactive here.

Returns

An extension that applies the middleware when used with .extend()


withParams()

withParams: <Target, Params>(parse) => ParamsExt<Target, Params>

Defined in: packages/core/src/core/extend.ts:330

Extension that transforms parameters before they reach the atom or action. Useful as the .set atom method can’t be reassigned and changed.

This utility lets you change how parameters are processed when an atom or action is called, enabling custom parameter handling, validation, or transformation.

Type Parameters

Target

Target extends AtomLike<any, any[], any>

The type of atom or action being extended

Params

Params extends any[]

The parameter types that will be accepted by the extended atom/action

Parameters

parse

(…parse) => OverloadParameters<Target extends Atom<any, [any]> ? Target<Target>["set"] : Target>[0]

Function that transforms the new parameters into what the atom/action expects

Returns

ParamsExt<Target, Params>

An extension that applies the parameter transformation

Example

// Convert from any unit to meters
const length = atom(0, 'length').extend(
withParams((value: number, unit: 'cm' | 'm' | 'km') => {
switch (unit) {
case 'cm':
return value / 100
case 'm':
return value
case 'km':
return value * 1000
default:
return value
}
}),
)
length(5, 'km') // Sets value to 5000 meters

withTap()

withTap: {(cb): GenericExt; <Target>(cb): Ext<Target, Target>; }

Defined in: packages/core/src/core/extend.ts:243

Creates an extension that allows observing state changes without modifying them.

This extension adds a middleware that calls the provided callback function whenever the atom’s state changes, passing the target atom, new state, and previous state. This is useful for side effects like logging, analytics, or debugging.

Call Signature

(cb): GenericExt

Parameters
cb

(target, state, prevState) => void

Returns

GenericExt

Call Signature

<Target>(cb): Ext<Target, Target>

Type Parameters
Target

Target extends AtomLike<any, any[], any>

Parameters
cb

(target, state, prevState) => void

Returns

Ext<Target, Target>

Example

const counter = atom(0, 'counter').extend(
withTap((target, state, prevState) => {
console.log(`${target.name} changed from ${prevState} to ${state}`)
}),
)

Param

Callback function that receives the target, new state, and previous state

Returns

An extension that can be applied to atoms or actions

Functions

_enqueue()

_enqueue(fn, queue): void

Defined in: packages/core/src/core/queues.ts:20

Schedules a function to be executed in a specific queue of the current context.

This is the core mechanism for scheduling reactive updates in Reatom. When an atom’s state changes, tasks are queued to be executed afterwards in the appropriate order. If this is the first task being scheduled, a microtask is created to process the queues asynchronously.

Parameters

fn

Fn

The function to schedule for execution

queue

QueueKind

The queue to add the function to (‘hook’, ‘compute’, ‘cleanup’, or ‘effect’)

Returns

void


_isPubsChanged()

_isPubsChanged(frame, pubs, from): boolean

Defined in: packages/core/src/core/atom.ts:609

This MUTATES frame.pubs

Parameters

frame

Frame

pubs

[null | Frame<any, any[], any>, ...dependencies: Frame<any, any[], any>[]]

from

number

Returns

boolean


_set()

_set(target, …params): any

Defined in: packages/core/src/core/atom.ts:769

Parameters

target

AtomLike

params

any[]

Returns

any


actions()

actions<Target, Methods>(this, options): ActionsExt<Methods>

Defined in: packages/core/src/core/actions.ts:78

Binds actions to an atom or action as methods.

This function adds methods to an atom or action by converting them to Reatom actions. Each method is converted to an action with the same name and bound to the target. The name of each action will be prefixed with the target’s name for better debugging.

Type Parameters

Target

Target extends AtomLike<any, any[], any>

The atom or action being extended

Methods

Methods extends Rec<Fn>

Record of functions to convert to actions

Parameters

this

Target

options

Either a record of methods or a function that creates methods given the target

Methods | (target) => Methods

Returns

ActionsExt<Methods>

The target with the methods added as actions

Example

const counter = atom(0, 'counter').actions({
increment: (amount = 1) => counter((prev) => prev + amount),
decrement: (amount = 1) => counter((prev) => prev - amount),
reset: () => counter(0),
})
counter.increment(5) // Can now call these methods directly
counter.reset()

Throws

If a method name collides with an existing property on the target


addGlobalExtension()

addGlobalExtension(extension): void

Defined in: packages/core/src/core/atom.ts:604

Registers a global extension that will be automatically applied to all atoms and actions created after registration.

This function allows you to add behavior to all Reatom entities in your application, such as tracking, logging, analytics, or debugging capabilities. Extensions registered with this function will be applied before any local extensions defined on individual atoms.

Parameters

extension

Ext

Extension function that receives an atom or action and returns it (optionally modified)

Returns

void

Example

import { addGlobalExtension, isAction, withCallHook } from '@reatom/core'
// Track all action calls for analytics
addGlobalExtension((target) => {
if (isAction(target)) {
target.extend(withCallHook(console.log))
}
return target
})

anonymizeNames()

anonymizeNames(): void

Defined in: packages/core/src/core/atom.ts:765

Useful for security reasons, if you need to increase your runtime complexity. It’s important to call this function before creating any atoms.

Returns

void


assertFn()

assertFn(fn): asserts fn is Fn

Defined in: packages/core/src/core/atom.ts:504

Parameters

fn

unknown

Returns

asserts fn is Fn


bind()

bind<Params, Payload>(target, frame): (…params) => Payload

Defined in: packages/core/src/core/atom.ts:1162

Light version of wrap that binds a function to the current reactive context.

Unlike the full wrap function, bind does not follow abort context, making it more lightweight but less safe for certain async operations. Use this when you need to preserve context but don’t need the abort handling capabilities of wrap.

Type Parameters

Params

Params extends any[]

The parameter types of the target function

Payload

Payload

The return type of the target function

Parameters

target

(…params) => Payload

The function to bind to the reactive context

frame

Frame<any, any[], any> = ...

The frame to bind to (defaults to the current top frame)

Returns

A function that will run in the specified context when called

(…params): Payload

Parameters
params

Params

Returns

Payload


clearStack()

clearStack(): void

Defined in: packages/core/src/core/atom.ts:1143

Clears the current Reatom context stack.

This is primarily used to force explicit context preservation via wrap(). By clearing the stack, any atom operations outside of a properly wrapped function will throw “missing async stack” errors, ensuring proper context handling.

Returns

void


computed()

computed<State>(computed, name?): Computed<State>

Defined in: packages/core/src/core/atom.ts:1007

Creates a derived state container that lazily recalculates only when read.

Computed atoms automatically track their dependencies (other atoms or computed values that are called during computation) and only recalculate when those dependencies change. The computation is lazy - it only runs when the computed value is read AND subscribed to.

Type Parameters

State

State

The type of state derived by the computation

Parameters

computed

A function that computes the derived state

() => State | (state?) => State

name?

string

Optional name for debugging purposes

Returns

Computed<State>

A computed atom instance

Example

const counter = atom(5, 'counter')
const doubled = computed(() => counter() * 2, 'doubledCounter')
// Reading triggers computation only if subscribed
const value = doubled() // -> 10

computedParams()

computedParams(next): any

Defined in: packages/core/src/core/atom.ts:980

Parameters

next

Fn

Returns

any


extend()

extend<This>(this, …extensions): This

Defined in: packages/core/src/core/extend.ts:111

Applies extensions to atoms or actions.

This is the core extension mechanism in Reatom that allows adding functionality to atoms and actions. Extensions can add properties, methods, or modify behavior. Extended atoms maintain their original reference identity.

Type Parameters

This

This extends AtomLike<any, any[], any>

The type of atom or action being extended

Parameters

this

This

extensions

Ext<AtomLike<any, any[], any>, AtomLike<any, any[], any>>[]

Array of extensions to apply to the atom/action

Returns

This

The original atom/action with extensions applied

Example

// Extending an atom with reset capability
const counter = atom(0, 'counter').extend(
withReset(0), // Adds counter.reset() method
withLogger('COUNTER'), // Adds logging middleware
)

isAction()

isAction(target): target is Action<any[], any>

Defined in: packages/core/src/core/action.ts:48

Type guard to check if a value is a Reatom action.

This function determines whether the given value is an action by checking if it’s an atom with non-reactive behavior (actions are non-reactive atoms).

Parameters

target

unknown

The value to check

Returns

target is Action<any[], any>

true if the value is a Reatom action, false otherwise


isAtom()

isAtom(value): value is AtomLike<any, any[], any>

Defined in: packages/core/src/core/atom.ts:394

Parameters

value

any

Returns

value is AtomLike<any, any[], any>


isComputed()

isComputed(target): boolean

Defined in: packages/core/src/core/atom.ts:1027

Checks if the provided target is a READONLY computed atom

Parameters

target

AtomLike

The atom to check

Returns

boolean

Boolean


isConnected()

isConnected(anAtom): boolean

Defined in: packages/core/src/core/atom.ts:501

Checks if an atom has active subscriptions.

This function determines if an atom is currently connected to any subscribers, which indicates that the atom is being actively used somewhere in the application. This is useful for optimizations or conditional logic based on whether an atom’s changes are being observed.

Parameters

anAtom

AtomLike

The atom to check for subscriptions

Returns

boolean

true if the atom has subscribers, false otherwise


isWritableAtom()

isWritableAtom(value): value is Atom<any, [newState: any]>

Defined in: packages/core/src/core/atom.ts:398

Parameters

value

any

Returns

value is Atom<any, [newState: any]>


mock()

mock<Params, Payload>(target, cb): Unsubscribe

Defined in: packages/core/src/core/atom.ts:1185

Mocks an atom or action for testing purposes.

This function replaces the original behavior of an atom or action with a custom callback function for the duration of the mock. This is useful for isolating units of code during testing and controlling their behavior.

Type Parameters

Params

Params extends any[]

The parameter types of the target atom/action

Payload

Payload

The return type of the target atom/action

Parameters

target

AtomLike<any, Params, Payload>

The atom or action to mock

cb

(…params) => Payload

The callback function to use as the mock implementation. It receives the parameters passed to the mocked atom/action and should return the desired payload.

Returns

Unsubscribe

A function that, when called, removes the mock and restores the original behavior.


notify()

notify(): void

Defined in: packages/core/src/core/queues.ts:69

Processes all scheduled tasks in the current context’s queues.

This function is called automatically after tasks have been scheduled via enqueue. It processes tasks in the following priority order:

  1. Hook tasks
  2. Compute tasks
  3. Cleanup tasks
  4. Effect tasks

The function resets priority after each task execution to ensure higher priority tasks (which may have been added during execution) are processed first.

Returns

void


run()

run<I, O>(this, fn, …params): O

Defined in: packages/core/src/core/atom.ts:355

Type Parameters

I

I extends any[]

O

O

Parameters

this

Frame

fn

(…params) => O

params

I

Returns

O


top()

top(): Frame

Defined in: packages/core/src/core/atom.ts:1124

Gets the current top frame in the Reatom context stack.

Returns the currently active frame in the execution stack, which contains the current atom being processed and its state.

Returns

Frame

The current top frame from the context stack

Throws

If the context stack is empty (missing async stack)