Open History to see the last commit
1---
2id: compileExpression
3title: compileExpression
4---
5
6# Function: compileExpression()
7
8```ts
9function compileExpression(expr, isSingleRow): CompiledSingleRowExpression | CompiledExpression;
10```
11
12Defined in: [packages/db/src/query/compiler/evaluators.ts:90](https://github.com/TanStack/db/blob/main/packages/db/src/query/compiler/evaluators.ts#L90)
13
14Compiles an expression into an optimized evaluator function.
15This eliminates branching during evaluation by pre-compiling the expression structure.
16
17## Parameters
18
19### expr
20
21[`BasicExpression`](../@tanstack/namespaces/IR/type-aliases/BasicExpression.md)
22
23### isSingleRow
24
25`boolean` = `false`
26
27## Returns
28
29`CompiledSingleRowExpression` \| `CompiledExpression`