Kaizen
Browse modulesRulesrules/sharedTypes

Type Alias: Condition<TDomain *extends* `string` = `string`>

type Condition<TDomain extends string = string> = Omit<InferredCondition, "domain" | "condition_type"> & {
  condition_type:   | ConditionType
     | string & {
   };
  domain: TDomain;
};

Defined in: shared/rules/types/conditions.ts:848

A condition row, with domain optionally narrowed by a consumer-supplied string literal union. Defaults to string so existing call sites keep their current typing; consumers opt into narrowing via Condition<MyDomain> for compile-time safety on the domain field. Runtime validation via the Condition Zod schema remains unchanged — it still accepts any string.

condition_type is widened to ConditionType | (string & {}) so custom condition types (registered via matchRules()'s customConditions option) are first-class on the Condition row. The (string & {}) brand keeps autocomplete for the built-in literals while accepting any string — a stored row with condition_type: "LOYALTY_TIER" is valid in TS without a cast, mirroring the runtime contract.

Type Declaration

condition_type

condition_type: 
  | ConditionType
  | string & {
};

domain

domain: TDomain;

Type Parameters

Type ParameterDefault type
TDomain extends stringstring

On this page