Skip to content

Improve doc typing when converting to array #1086

@bakura10

Description

@bakura10

Hello,

Liquid currently lacks a lot in the array manipulation area, but there are a lot of tricks to workaround. One common trick is to create an array from a variable using the sort filter:

for media in product.media
  assign media_as_array = media | sort
endfor

Which then allows to concat it to another array. The issue is that currently the type is lost, so while media is properly typed as "media", after the sort operation it becomes untyped[]

Until we can have better array functions, could the typing be improved so that the type is preserved?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions