---
title: ValidBlockArgumentTypes
description: >-
  Identifies block tag arguments whose literal values don't match the target
  block's parameter types.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-block-argument-types
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-block-argument-types.md
api_name: liquid
---

# ValidBlockArgumentTypes

Identifies literal argument values in a `{% block %}` tag that don't match the type of the corresponding parameter in the target block. A parameter's type comes from the block's schema setting when one exists, and from the block's [LiquidDoc](https://shopify.dev/docs/storefronts/themes/tools/liquid-doc) otherwise. The built-in `content` parameter is always a `string`.

An `object` parameter accepts any literal, and a `boolean` parameter accepts any literal except a range or an array. Other types must match exactly, so a literal never matches a resource type such as `product`, and an array must have the declared element type.

This check skips variable lookups, empty arrays, arrays that contain a variable lookup, arguments that the block doesn't declare, and parameters without a type. For a parameter with a string-literal type, such as `'primary' | 'secondary'`, this check still reports empty arrays and arrays that contain a variable lookup, because only a string from the list is valid. It exits without reporting when the block file is missing or its schema is invalid.

In a block file, this check also reports a LiquidDoc parameter type that differs from the type of the schema setting with the same ID, or a `content` parameter that LiquidDoc doesn't type as `string`. A LiquidDoc type of `object`, or a string literal type such as `'primary' | 'secondary'`, is always accepted.

**Note:**

These checks all validate `{% block %}` tag arguments: [`DuplicateBlockArguments`](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/duplicate-block-arguments), [`MissingBlockArguments`](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/missing-block-arguments), [`UnrecognizedBlockArguments`](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unrecognized-block-arguments), and [`ValidBlockArgumentTypes`](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/valid-block-argument-types).

***

## Examples

The following examples contain code snippets that either fail or pass this check.

The examples reference the following block:

## blocks/button.liquid

```liquid
{% doc %}
  @param {string} [variant] - Button variant
  @param {number} [count] - Item count
{% enddoc %}
<button class="button button--{{ variant }}">{{ content }} ({{ count }})</button>
```

### ✗ Fail

In the following example, `variant: 42` doesn't match the `string` type declared in the block's LiquidDoc, so Theme Check reports `Type mismatch for argument 'variant': expected string, got number`:

## templates/index.liquid

```liquid
{% block 'button', variant: 42 %}
  Button content
{% endblock %}
```

### ✓ Pass

In the following example, `variant` is passed a string value:

## templates/index.liquid

```liquid
{% block 'button', variant: 'primary' %}
  Button content
{% endblock %}
```

### ✓ Pass

In the following example, `variant` is passed a variable lookup, which this check skips:

## templates/index.liquid

```liquid
{% assign my_var = 'primary' %}


{% block 'button', variant: my_var %}
  Button content
{% endblock %}
```

### ✗ Fail

In the following block file, LiquidDoc declares `heading` as a `number`, but the `heading` schema setting is a `text` setting, which has the type `string`. Theme Check reports `The schema setting 'heading' has Liquid type 'string', but LiquidDoc declares 'number'. The schema setting type is authoritative.`:

## blocks/heading.liquid

```liquid
{% doc %}
  @param {number} [heading] - Heading text
{% enddoc %}
<h2>{{ heading }}</h2>


{% schema %}
{
  "name": "Heading",
  "settings": [
    { "type": "text", "id": "heading", "label": "Heading" }
  ]
}
{% endschema %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
ValidBlockArgumentTypes:
  enabled: true
  severity: warning
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended. If you can't avoid violating the rule, then you should disable the check using the [comment syntax](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#disable-checks-using-liquid-comments). This ensures that you intentionally disable the check for each instance.

```liquid
{% # theme-check-disable ValidBlockArgumentTypes %}
{% block 'button', variant: 42 %}
  Button content
{% endblock %}
{% # theme-check-enable ValidBlockArgumentTypes %}
```

***
