Open bsidhom opened 1 day ago
I do have the same issue.
Astro v4.16.12
Node v22.11.0
System Linux (arm64)
Package Manager pnpm
Output server
Adapter @astrojs/node
Integrations @astrojs/react
@astrojs/mdx
Worth to mention that the build works perfectly, it's just in Vscode.
Also here is what eslint says:
> eslint .
/workspaces/website/.astro/astro/content.d.ts
4:46 error The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
- If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
- If you want a type meaning "any object", you probably want `object` instead.
- If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
6:44 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
7:44 error The `{}` ("empty object") type allows any non-nullish value, including literals like `0` and `""`.
- If that's what you want, disable this lint rule with an inline comment or configure the 'allowObjectTypes' rule option.
- If you want a type meaning "any object", you probably want `object` instead.
- If you want a type meaning "any value", you probably want `unknown` instead @typescript-eslint/no-empty-object-type
16:43 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
40:34 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
148:53 error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
/workspaces/website/.astro/types.d.ts
2:1 error Do not use a triple slash reference for astro/content.d.ts, use `import` style instead @typescript-eslint/triple-slash-reference
✖ 7 problems (7 errors, 0 warnings)
Ah anyway, I figured out I forgot to include "include": ["./src/**/*.astro"]
in my tsconfig.json
. Now it works like a charm, sorry for the noise.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No browser; this is a development issue
Describe the Bug
With a minimal project using yarn 4.5.1, Astro 4.16.12 and the latest official VSCode Astro extension, I'm getting an error in my
src/content/config.ts
file when I try to do the following import:This is the error I see:
I can confirm that, indeed, the
defineCollection
andz
declarations are missing from the.astro/astro/content.d.ts
typing file. (I can share the contents of that file if desired, but you should be able to reproduce with my sample.)I've linked a minimal reproduction. To initialize the project, I just ran
yarn init -2
, added the relevant Astro dev dependencies, and pasted in a few filler content files. I see the same issue whether I put everything intodependencies
ordevDependencies
in mypackage.json
, so it does not appear to be a dev-vs-runtime dependency issue.Note that I wasn't able to insert slashes (
/
) into the gist files, so I've replaced those with underscores (_
).I've also run
astro sync
,astro check
, andastro build
. All result in the same VSCode type error. I am able to successfully build and view the website.Finally, the closest previous issue I could find to this one was https://github.com/withastro/astro/issues/5711, which seems to be complaining that the module doesn't exist at all. This is not what I'm seeing; instead, I'm seeing that not all of the module exports are getting into the declaration file.
What's the expected result?
The
.astro/astro/content.d.ts
should contain all relevant typings and should allow type checking of collection schemas.Link to Minimal Reproducible Example
https://gist.github.com/bsidhom/88417490e8dc651a17f1608c5af3067c
Participation