Skip to content

Compiler error when a JS expression contains <= #762

Closed
@giuseppelt

Description

@giuseppelt

What version of astro are you using?

2.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

Inside an astro component, this will not compile:

---
const array = [1,2,3,4];
---
<body>
    {
      array.filter(x => x <= 3)
        .map(x => <span>{x}</span>)
    }
</body>

The error:
Unable to assign attributes when using <> Fragment shorthand syntax!

Only the <= produces the error. Other operators work fine.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-6n1a9b-wnnkry?file=src%2Fpages%2Findex.astro&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly improves performance (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions