Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error when a JS expression contains <= #762

Closed
1 task
giuseppelt opened this issue Mar 16, 2023 · 3 comments
Closed
1 task

Compiler error when a JS expression contains <= #762

giuseppelt opened this issue Mar 16, 2023 · 3 comments
Assignees
Labels
- P4: important Violate documented behavior or significantly improves performance (priority)

Comments

@giuseppelt
Copy link

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.
@matthewmercuri
Copy link

Somewhat related - the stylized error spits out a link that 404s. Problematic code I believe is here

@Princesseuh Princesseuh transferred this issue from withastro/astro Mar 23, 2023
@natemoo-re natemoo-re self-assigned this Mar 23, 2023
@natemoo-re natemoo-re added the - P4: important Violate documented behavior or significantly improves performance (priority) label Jun 27, 2023
@OverflowCat
Copy link

I also encountered this issue today. Adding parentheses around the conditions can sometimes be another temporary workaround, but parentheses will be formatted.

@Princesseuh
Copy link
Member

Closing as duplicate of #723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly improves performance (priority)
Projects
None yet
Development

No branches or pull requests

5 participants