Skip to content

Cannot consume @rest... when not specified #4352

@Bilge

Description

@Bilge

To reproduce:

.foo(@a, @rest...) {
  .bar(@a, @rest);
}

.bar(@a, @b: false) {}

.foo(@a, true); // works
.foo(@a); // Cannot read properties of undefined (reading 'value')

Current behavior:

Consuming an optional variadic that is not set causes an error.

Expected behavior:

Since (@a, @rest...) supports 1..N arguments, it should be expected that in the 1 case, @rest is unset, and if so, passing @rest should be valid and a no-op instead of an error.

Environment information:

  • less version: 4.4.0
  • nodejs version: v22.12.0
  • operating system: 6.6.87.2-microsoft-standard-WSL2

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