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

Astro check fails when importing props from another component #814

Closed
1 task
WesSouza opened this issue Jun 11, 2023 · 2 comments · Fixed by #817
Closed
1 task

Astro check fails when importing props from another component #814

WesSouza opened this issue Jun 11, 2023 · 2 comments · Fixed by #817
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@WesSouza
Copy link

What version of astro are you using?

2.6.3

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

Vercel

What package manager are you using?

pnpm

What operating system are you using?

Mac and Linux

What browser are you using?

N/A

Describe the Bug

One of my components was importing a type from another Astro component's Props, but that stopped working since at least 2.4.0.

// ComponentA.astro
import type { Props as ComponentBProps } from './ComponentB.astro'
❯ npm run astro check

> @example/[email protected] astro
> astro check

05:11:05 PM [check] Checking files
05:11:06 PM [content] No content directory found. Skipping type generation.
✔  Getting diagnostics for Astro files in /home/projects/github-2auewc/…
05:11:06 PM [diagnostics] 
 /home/projects/github-2auewc/src/pages/ComponentA.astro:1:1 Error: Cannot find name 'Props'.
01  ---
    
02  import type { Props as ComponentBProps } from './ComponentB.astro'

05:11:06 PM [diagnostics] Result (3 files): 
- 1 error
- 0 warnings
- 0 hints

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-2auewc?file=src%2Fpages%2FComponentA.astro,src%2Fpages%2FComponentB.astro&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P3: minor bug An edge case that only affects very specific usage (priority) label Jun 12, 2023
@bluwy
Copy link
Member

bluwy commented Jun 20, 2023

While working on withastro/astro#7430, I found this is caused by @astrojs/compiler v1.5.1, where v1.5.0 works for me.

@bluwy bluwy self-assigned this Jul 3, 2023
@bluwy bluwy transferred this issue from withastro/astro Jul 3, 2023
@bluwy bluwy removed their assignment Jul 5, 2023
@natemoo-re
Copy link
Member

Thanks for opening this! I'm looking into what happened on the compiler side that caused this. Hoping to get a fix out shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants