/** Array prop — a list of a scalar inner prop (e.g. arrayOf(date()) → Date[]). */
export type ArrayProp
= PropDef<"array", P>;
export type BooleanProp = PropDef<"boolean", null>;
export type DateProp = PropDef<"date", null>;
export type InferContext> = InferContextRaw extends infer T ? {
[K in keyof T]: T[K];
} & {} : never;
export type InferPropType = P extends StringProp ? string : P extends NumberProp ? number : P extends BooleanProp ? boolean : P extends DateProp ? Date : P extends OneOfProp ? T[number] : P extends LifecycleProp ? T[number] : P extends ArrayProp ? InferPropType[] : never;
/**
* Lifecycle prop — defines the state machine states for a model.
* Only lifecycle() values are valid in from().to() transitions.
* Use oneOf() for regular enums that don't participate in transitions.
*/
export type LifecycleProp = PropDef<"lifecycle", T>;
export type NumberProp = PropDef<"number", null>;
export type OneOfProp = PropDef<"oneOf", T>;
export type PropDef = {
readonly kind: K;
readonly values: V;
};
export type PropKind = "array" | "boolean" | "date" | "lifecycle" | "number" | "oneOf" | "string";
export type StringProp = PropDef<"string", null>;
type InferContextRaw> = {
[K in keyof Props as Props[K] extends OptionalPropDef ? K : never]?: InferPropType;
} & {
[K in keyof Props as Props[K] extends OptionalPropDef ? never : K]: InferPropType;
};
/** Runtime brand for optional props — set by optional(), checked by isOptional(). */
declare const OPTIONAL_BRAND: unique symbol;
export { OPTIONAL_BRAND };
/** Symbol used to store the original tuple on a StatesObject. */
declare const STATES_VALUES: unique symbol;
/** Phantom brand — type-level only, prevents structural spoofing. Same pattern as ModelRef. */
declare const STATES_BRAND: unique symbol;
/** Object returned by lifecycle.states() — named keys mapping to themselves, plus a hidden tuple. */
export type StatesObject = {
readonly [K in T[number]]: K;
} & {
readonly [STATES_BRAND]: true;
readonly [STATES_VALUES]: T;
};
export declare const string: () => StringProp;
export declare const number: () => NumberProp;
export declare const boolean: () => BooleanProp;
export declare const date: () => DateProp;
/** A list of a scalar prop: arrayOf(string()) → string[], arrayOf(date()) → Date[]. */
export declare const arrayOf: (inner: P & (P extends LifecycleProp ? never : P)) => ArrayProp;
export type OptionalPropDef
= P & {
readonly [OPTIONAL_BRAND]: true;
};
/** Wraps a prop as optional. Lifecycle props cannot be optional — a model always has a current state. */
export declare const optional:
(prop: P & (P extends LifecycleProp ? never : P)) => OptionalPropDef;
/** Check if a prop was wrapped with optional() at runtime. */
export declare const isOptional: (prop: PropDef) => prop is OptionalPropDef;
export declare const oneOf: (values: T) => OneOfProp;
declare function _lifecycle(values: StatesObject): LifecycleProp;
declare function _lifecycle(values: T): LifecycleProp;
export declare const lifecycle: typeof _lifecycle & {
states: (...names: T) => StatesObject;
};
//# sourceMappingURL=props.d.ts.map