UNPKG

779 BTypeScriptView Raw
1import type { Nullable } from './core.js';
2
3export type ConstantReference = 0;
4export type ComputeReference = 1;
5export type UnboundReference = 2;
6export type InvokableReference = 3;
7
8export interface ReferenceTypes {
9 readonly Constant: ConstantReference;
10 readonly Compute: ComputeReference;
11 readonly Unbound: UnboundReference;
12 readonly Invokable: InvokableReference;
13}
14
15export type ReferenceType =
16 | ConstantReference
17 | ComputeReference
18 | UnboundReference
19 | InvokableReference;
20
21declare const REFERENCE: unique symbol;
22export type ReferenceSymbol = typeof REFERENCE;
23
24export interface Reference<T = unknown> {
25 [REFERENCE]: ReferenceType;
26 debugLabel?: string | undefined;
27 compute: Nullable<() => T>;
28 children: null | Map<string | Reference, Reference>;
29}