onwidget / astrolib

46 stars 8 forks source link

Cannot find module `./src/AstroSeo.astro` or its corresponding type declarations #9

Open bennycode opened 9 months ago

bennycode commented 9 months ago

I installed @astrolib/seo v1.0.0-beta.4 in my TS project but when I run npx tsc --noEmit I am getting the following errors:

node_modules/@astrolib/seo/index.ts:4:37 - error TS2307: Cannot find module './src/AstroSeo.astro' or its corresponding type declarations. 4 export { default as AstroSeo } from "./src/AstroSeo.astro";

node_modules/@astrolib/seo/index.ts:5:15 - error TS2307: Cannot find module './src/AstroSeo.astro' or its corresponding type declarations. 5 export * from "./src/AstroSeo.astro";

I checked my code that imports from @astrolib/seo and it looks like it offers 2 type definitons for the same root package (located in ./index.ts and ./src/types.ts):

image

How can I tell TS to use only one of the two? I am running on TypeScript Version 5.2.2.

bennycode commented 4 months ago

@prototypa, could this error originate from the fact the import comes from a file with a .astro extension?

There is the allowArbitraryExtensions compiler flag which states that it needs a *.d.astro.ts file for a custom extension like this.