jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
975 stars 51 forks source link

Get `Cannot find module 'astro-seo' or its corresponding type declarations.ts(2307)` #49

Open LushawnDev opened 1 year ago

LushawnDev commented 1 year ago

Hey, love your Astro integration! Does it/can it support typescript out of the box or by doing npm install @types/astro-seo? I get the following error when importing it into a page like so:

---
import { SEO } from "astro-seo";
---

Gives: Cannot find module 'astro-seo' or its corresponding type declarations.ts(2307)

I am fairly new to typescript, but pretty sure it can be added to the DefinitelyTyped repo, it's just a bit past my expertise how to.

At the moment I am supressing the typescript warning by using // @ts-ignore

Thanks for your contributions!

madrus commented 1 year ago

Same here. I am adding this line to env.d.ts as another workaround:

declare module 'astro-seo'

But it would be better to have types out of the box.

jonasmerlin commented 1 year ago

Hey @LushawnDev and @madrus. I can't seem to reproduce this in a newly created astro project with astro 1.9.0, astro-seo 0.7.0 and TS rules set to "strictest". Can you maybe provide any steps to reproduce?

ZermattChris commented 1 year ago

Same here. I am adding this line to env.d.ts as another workaround:

declare module 'astro-seo'

But it would be better to have types out of the box.

That fixed the warning above, but it fails on Build (just installed a fresh v2.0 Astro)

ZermattChris commented 1 year ago

image

Ihatetomatoes commented 8 months ago

Try restarting TS Server or VSCode, that fixed it for me. I didn't have to add any new declarations in env.d.ts.

alexandrstudio commented 4 months ago

Using Zed editor and have the same issue, but solve it by adding

declare module 'astro-seo'

to env.d.ts