withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!

Home Page:https://astro.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type Errors in `examples/framework-react` on init in VS Code

apetta opened this issue · comments

Astro Info

$ astro info
Astro                    v4.5.9
Node                     v18.18.2
System                   macOS (arm64)
Package Manager          yarn
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

After setting up the example via pnpm/yarn create astro@latest -- --template framework-react, if you open a *.tsx file, VS Code type checking immediately begins complaining about type mismatches in .astro files in the node_modules folder from the astro package:
Screenshot 2024-03-26 at 10 52 28

I have tried adding node_modules to the exclude field in tsconfig.json, but no luck.

It doesn't seem to hinder astro dev or build commands in any way, purely an annoyance in VS Code.

What's the expected result?

No errors.

Link to Minimal Reproducible Example

https://github.com/withastro/astro/tree/main/examples/framework-react

Participation

  • I am willing to submit a pull request for this issue.

Uninstalling the Astro VS Code extension does make the errors go away...

#10562 seems to make these errors go away whilst having the Astro VS Code extension installed.

I'm quite new to Astro, so I'm not entirely sure what's causing this or why it's even type checking the node_modules directory.

Just documenting my experience in case someone more knowledgeable on the topic can chime in.

For now, I'm just applying the above changes as a patch via patch-package so I don't have to look at these errors 🙃