Skip to content

Provide error when mixin results in [object Object] value #4305

Open
@matthew-dean

Description

@matthew-dean

Discussed in #4304

Originally posted by uncenter December 31, 2024
I have a mixin called rgbify, as seen below:

#rgbify(@color) {
  @rgb: red(@color), green(@color), blue(@color);
}

It can be used as color: #rgbify(#fff)[];, and note the [] to capture the return value(s). Without the [] (just #rgbify(#fff)), Less outputs [object Object] as the value for wherever the mixin is used. I most definitely did not mean to have the value be [object Object], and I'm hoping Less could error when it encounters a value like that - otherwise i have no good way of knowing I missed it if I'm not looking carefully/specifically for that mistake.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions