Transform fails when the opening bracket of an interface is not on the same line as the `interface` keyword
What version of astro are you using?
1.1.3
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
I encountered this bug while declaring a Props interface that extended multiple interfaces. Because their names were long, prettier formatted it so the interface declaration spanned multiple lines, kind of like this:
interface Props
extends Interface1, Interface2 {
// ...interface properties
}
But this caused the following error:
Transform failed with 1 error: /home/projects/github-2nzrgw/src/components/Card.astro:29:0: ERROR: Expected "{" but found "const"
I thought it had to do with extends or the fact that I was using generics in my code, but after playing with it for a bit in StackBlitz I realized that it has to do with the opening bracket ({) not being on the same line as the interface keyword.
// if we do this transform fails
interface Props extends Interface1, Interface2
{
// ...interface properties
}
// but if we do this then everything works fine
interface Props extends Interface1, Interface2 {
// ...interface properties
}
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-2nzrgw?file=src/components/Card.astro
Participation
- [ ] I am willing to submit a pull request for this issue.