# type

Returns the JavaScript type of a value as a string. Useful for debugging and conditional logic based on data types.

```liquid
{% assign t = my_var | type %}
{% log t %}
```

#### Syntax

```liquid
{{ value | type }}
```

| Parameter | Description                    |
| --------- | ------------------------------ |
| `value`   | Any value to check the type of |

#### Return Value

Returns a string — one of: `"string"`, `"number"`, `"boolean"`, `"object"`, `"undefined"`.

#### Examples

**Check the type of a variable:**

```liquid
{% assign t = product.price | type %}
{% log "Price type: " | append: t %}
```

Output:

```
Price type: string
```

**Conditional logic based on type:**

```liquid
{% assign t = input_value | type %}
{% if t == "string" %}
  {% assign parsed = input_value | parse_json %}
{% elsif t == "object" %}
  {% assign parsed = input_value %}
{% endif %}
{% log parsed %}
```

**Debug unknown data:**

```liquid
{% log "Value: " | append: my_var %}
{% log "Type: " | append: my_var | type %}
```

**Validate function parameters:**

```liquid
{% assign t = email | type %}
{% if t == "undefined" %}
  {% log "Error: email parameter is required" %}
  {% return nil %}
{% endif %}
```

#### Notes

* Returns JavaScript `typeof` values: `"string"`, `"number"`, `"boolean"`, `"object"`, `"undefined"`
* Arrays return `"object"` — use the `size` filter to check if a value is array-like
* `null` returns `"object"` (standard JavaScript behavior)
* Useful for debugging when you're unsure what type a variable holds
