-
Notifications
You must be signed in to change notification settings - Fork 80
Closed as not planned
Labels
needs triageIssue needs to be triagedIssue needs to be triaged
Description
What version of @astrojs/compiler
are you using?
2.10.3
What package manager are you using?
pnpm
What operating system are you using?
Windows
Describe the Bug
When exporting certain kinds of types, the compiler can output code that ends up breaking up the type, leading to 'unexpected ' errors:
export type MyType = { foo: any
} & { bar: any }
ends up producing the following code, which (understandably) raises an Unexpected "&"
error.
export type MyType = { foo: any
}
const $$Index = $$createComponent(($$result, $$props, $$slots) => {
const Astro = $$result.createAstro($$Astro, $$props, $$slots);
Astro.self = $$Index;
& { bar: any }
I have confirmed this behavior for intersection, union and function types, but additional ones may exist.
While the issue can be worked around once you're aware of it, its:
- not very easy to spot (since the typescript is correct in editor),
- the resulting exceptions' stack traces are not useful and
- the line number points at the wrong location in the file (or outside of it altogether).
Additionally, I believe this issue is closely related to #997.
Link to Minimal Reproducible Example
Metadata
Metadata
Assignees
Labels
needs triageIssue needs to be triagedIssue needs to be triaged