Homepage

ValidRenderPartialArgumentTypes

Last edit: Aug 03, 2026

ValidRenderPartialArgumentTypes

Severity: warning | Type: LiquidHtml | Aliases: ValidRenderPartialParamTypes

This check ensures that arguments passed to a partial match the expected types declared in the partial's {% doc %} tag. When a type mismatch is detected, the check reports it with a suggestion to fix the value.

The check handles both named arguments ({% render 'card', title: "Hello" %}) and the alias syntax ({% render 'card' with 123 as count %}).

Type checking is only performed when:

  1. The target partial has a {% doc %} tag.
  2. The @param entry includes a type annotation (e.g. @param {string} title).
  3. The annotated type is one of string, number, boolean, object or array — object types from the Liquid objects reference and []-suffixed types are accepted in the annotation but not type-checked at the call site.
  4. The argument value is a literal (string, number, boolean, array) — variable lookups and filtered values are not type-checked statically, since their type cannot be determined without running the code.

Two types are deliberately permissive:

  • boolean accepts any value, because every value in Liquid is truthy or falsy.
  • object accepts an array as well as an object, because it stands for anything that is not a primitive. Annotate a parameter as array when you want a non-list argument to be reported.

nil and null are accepted for every type — they mean "no value".

Examples

✗ Incorrect Code Example (Avoid using this):


{% comment %}app/views/partials/count-badge.liquid{% endcomment %}
{% doc %}
  @param {number} count - Number of items to display
{% enddoc %}
<span class="badge">{{ count }}</span>


{% comment %}Calling site — passing a string where a number is expected{% endcomment %}
{% render 'count-badge', count: "five" %}

✓ Correct Code Example (Use this instead):


{% render 'count-badge', count: 5 %}
{% render 'count-badge', count: item.count %}

Arrays


{% comment %}app/views/partials/tag-list.liquid{% endcomment %}
{% doc %}
  @param {array} tags - Tags to display
{% enddoc %}


{% comment %}Error — expected array, got string{% endcomment %}
{% render 'tag-list', tags: 'news' %}

{% comment %}OK{% endcomment %}
{% render 'tag-list', tags: ['news', 'events'] %}

Configuration

The default configuration for this check:

ValidRenderPartialArgumentTypes:
  enabled: true
  severity: warning

Disabling This Check

This check is safe to disable if your codebase passes values of different types intentionally and relies on Liquid's dynamic type coercion.

Resources

Questions?

We are always happy to help with any questions you may have.

contact us