Articles in this section

typeOf helper

The typeOf helper returns the JavaScript type of a given value as a lowercase string. Use it to identify whether a field contains a number, string, array, or object before applying type-dependent logic in a flow.

Syntax

{{typeOf value}}

value -- The value to evaluate. Required.

Return values

Input type Output
Number number
String string
Boolean boolean
Array array
Object object
null object
undefined undefined

Examples

Check the types of common field values

{{typeOf record.age}}
{{typeOf record.flag}}
{{typeOf record.firstName}}
{{typeOf record.items}}
{{typeOf record.note}}

Input:

{
 "record": {
 "age": 25,
 "flag": true,
 "firstName": "Alice",
 "items": [{ "sku": "ITEM001", "quantity": 2 }],
 "note": null
 }
}

Output:

number
boolean
string
array
object

record.note is null, which returns object -- a known behavior of JavaScript's type system.

Use typeOf in a conditional block

{{#compare (typeOf record.value) "===" "number"}}
 Formatting as number
{{else}}
 Formatting as string
{{/compare}}

If record.value is a number, the first branch renders. For any other type, the {{else}} branch renders.

Usage notes

  • typeOf always returns a lowercase string: number, string, boolean, array, object, or undefined.
  • null returns object, not null -- this is a known behavior of JavaScript's type system.
  • Use typeOf inside #compare to build conditional logic based on field type.
  • To check specifically whether a value is an array, compare the typeOf result to "array". isArray is a #some condition name, not a separate helper.