Non-ternary conditional template causes `astro check` error
What version of astro are you using?
1.0.5
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
Mac
Describe the Bug
Using non-ternary conditional expressions in templates works fine, but shows errors when running astro check (no default export).
The following works fine, but results in an error.
{someCondition && <span>Hello</span>}
{someCondition && <span>World</span>}
This line also works fine but does not result in an error.
{someCondition ? <span>Hello</span> : <span>World</span>}
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-efqcer?file=src/pages/index.astro
Participation
- [ ] I am willing to submit a pull request for this issue.
Hello, thank you for filling this issue. This is an issue with how we parse files in the Astro language server at the moment. We're currently in the progress of migrating to a new parser that should fix this issue!
You can track progress on that here https://github.com/withastro/language-tools/pull/335
I'm sorry for the inconvenience 😅
Hello, thank you for filling this issue. This is an issue with how we parse files in the Astro language server at the moment. We're currently in the progress of migrating to a new parser that should fix this issue!
You can track progress on that here https://github.com/withastro/language-tools/pull/335
I'm sorry for the inconvenience 😅
It wasn't an inconvenience at all and actually made me refactor my code for better readability. Thanks for your work!
Fixed by https://github.com/withastro/language-tools/pull/335