mahler
Version:
A automated task composer and HTN based planner for building autonomous system agents
29 lines (28 loc) • 600 B
TypeScript
/**
* A reference to a value
*
* JavaScript does not support passing function arguments by reference, we use
* the `Ref` type to simulate this behavior. Wraping a value in a `Ref` allows
* the value to be mutated by a function.
*/
export interface Ref<T> {
_: T;
}
/**
* Construct a reference from a given value
*
* Example:
*
* ```ts
* const ref = Ref.from(1);
* // The value of ref is now 2
* ref._++;
* ```
*/
declare function of<T>(t: T): Ref<T>;
declare function is<T>(x: unknown): x is Ref<T>;
export declare const Ref: {
is: typeof is;
of: typeof of;
};
export {};