withastro / language-tools

Language tools for Astro
MIT License
269 stars 53 forks source link

Index.ts Cannot Export (Find) Image.astro or Picture.astro #503

Closed ReyWins closed 1 year ago

ReyWins commented 1 year ago

What version of astro are you using?

2.0

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

None

What package manager are you using?

nmp, pnmp, npx

What operating system are you using?

Mac

What browser are you using?

Chrome, Safari

Describe the Bug

Hello!

(I am fairly new to Astro, so I apologize in advance if one of my responses doesn't make sense).

The issue is occurring in index.ts under the /components/ folder.

I receive the following errors:

Cannot find module './Image.astro' or its corresponding type declarations.ts(2307) Cannot find module './Picture.astro' or its corresponding type declarations.ts(2307)

It's affecting my Blog Layout when I try to enter the width and height dimensions (see picture below).

I've checked to make sure all the paths are correct (and they are). I've also tried to reinstall @astrojs/image and still no luck.

Screenshot 2023-04-09 at 21 38 54 Screenshot 2023-04-09 at 21 43 56

Thank you for your support!

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-zetqna?file=src/layouts/BlogPostLayout.astro

Participation

Princesseuh commented 1 year ago

Which version of the VS Code extension are you using? This is purely an editor problem, caused by our TypeScript plugin not starting correctly in some cases.

I'd recommend trying out the pre release version to see if it helps.

The two errors you're having are also unrelated, the second error is simply asking you to use a number instead of a string

ReyWins commented 1 year ago

Sorry, where should I look at to find the extension in VSCode you're referring to?

The prerelease version of Typescript or Astro? I do have the pre-release extension for Astro on my VSCode (if that's what you were referring to).

Princesseuh commented 1 year ago

That is what I was referring to, yes! It probably doesn't work well inside files in node_modules, TypeScript plugins are not too good at that.

Like I said this error is not causing the second error you posted, it's just asking you to do width={300} instead of width="300". You can safely ignore the error happening in that index.ts.

ReyWins commented 1 year ago

@Princesseuh -- Thank you so much! I'll try that fix later in the day and get back to you. If all is well, I'll close the thread.

ReyWins commented 1 year ago

Thank you, when I changed the syntax, it worked. I didn't change anything in the index.ts -- so we are good to go!

Appreciate you!