Build fails when exporting a type using MarkdownLayoutProps
What version of astro are you using?
1.6.6
Are you using an SSR adapter? If so, which one?
No
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Exporting a type using MarkdownLayoutProps causes the following error.
[plugin:astro:build] Expected ">" but found "const"
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-yaiimj?file=src/pages/index.astro
Participation
- [ ] I am willing to submit a pull request for this issue.
The correct usage of this feature is to not export the type Edit: I was wrong actually
Got it. To clarify I exported it to stop the @typescript-eslint/no-unused-vars rule from complaining, what should I do instead? Should I just configure the rule to not apply for this type in astro files?
Maybe you can use a // @ts-ignore ?
Yes, suppressing the error is what I'm doing now, with // eslint-disable-next-line @typescript-eslint/no-unused-vars, but I was wondering if there was a better way to handle this.
I opened the issue because the error message seemed to me like a weird one, thought it might be a bug, but feel free to close if this is expected. Thanks!
Sorry, I'm not aware of a better way to handle this
@Princesseuh can you take a look if this error message can be improved?
This seems to be a compiler bug, maybe something to do with the export + the generic argument confusing the compiler?
@Princesseuh Yeah that sounds right. I recall seeing this error message on generic types before 🤷
Moving to the compiler repo. fwiw, removing the export makes it work. Exporting Props is unnecessary (it does nothing for editor tooling and never has) and generally unwanted, so I consider this a good workaround in this case. The Astro ESLint plugin should handle this better.
Could be related to https://github.com/withastro/compiler/issues/554