Skip to content

Type Alias: ExpressionDto

@kortexya/reasoninglayer


@kortexya/reasoninglayer / ExpressionDto

ExpressionDto = { name: string; type: "Variable"; } | { type: "Literal"; value: FunctionValueDto; } | { left: ExpressionDto; op: BinaryOperatorDto; right: ExpressionDto; type: "BinaryOp"; } | { arguments: ExpressionDto[]; functionName: string; type: "FunctionCall"; } | { op: UnaryOperatorDto; operand: ExpressionDto; type: "UnaryOp"; } | { branches: ConditionalBranchDto[]; default?: ExpressionDto | null; type: "Conditional"; }

Defined in: src/types/functions.ts:68

Arithmetic/logical expression used in function bodies and guards.

{ name: string; type: "Variable"; }


{ type: "Literal"; value: FunctionValueDto; }


{ left: ExpressionDto; op: BinaryOperatorDto; right: ExpressionDto; type: "BinaryOp"; }


{ arguments: ExpressionDto[]; functionName: string; type: "FunctionCall"; }


{ op: UnaryOperatorDto; operand: ExpressionDto; type: "UnaryOp"; }


{ branches: ConditionalBranchDto[]; default?: ExpressionDto | null; type: "Conditional"; }

branches: ConditionalBranchDto[]

Branches, tried in order; the first whose when holds supplies the value.

optional default?: ExpressionDto | null

The value when no branch holds. null when the conditional has none.

type: "Conditional"

A recursive tagged union. BinaryOp contains nested ExpressionDto children. FunctionCall allows calling other user-defined functions within an expression.