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

rendering of component failed, due to type definition on multiple lines #826

Closed
1 task
y-nk opened this issue Jul 12, 2023 · 1 comment
Closed
1 task

Comments

@y-nk
Copy link

y-nk commented Jul 12, 2023

What version of astro are you using?

2.8.0

Are you using an SSR adapter? If so, which one?

no

What package manager are you using?

npm

What operating system are you using?

mac

What browser are you using?

chrome

Describe the Bug

Problem statement

A component with a specific type Props definition cannot be rendered. There's an error in parsing the file, which i suspect is because the type is formatted on multiple lines.

Usecase

The type which makes it fail in my usecase is:

export type Props = Omit<Strapi.Simplified<Strapi.NavItem>, 'hasNestedLinks' | 'title'>

...which prettier refactor as:

export type Props = Omit<
  Strapi.Simplified<Strapi.NavItem>,
  'hasNestedLinks' | 'title'
>

and gives the following:

image

Proofs

  • When i edit the file in vim and force back the type to be on one line, the error disappears.
  • When i add // prettier-ignore above the type as a oneliner, the error disappears

What's the expected result?

We should not have issue with types being defined on multiple lines.

Link to Minimal Reproducible Example

https://codesandbox.io/p/sandbox/wizardly-sanderson-6ckszp

Participation

  • I am willing to submit a pull request for this issue.
@bluwy bluwy transferred this issue from withastro/astro Jul 12, 2023
@Princesseuh
Copy link
Member

Duplicate of #554

@Princesseuh Princesseuh marked this as a duplicate of #554 Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants