The astro:content module is a virtual module so its types are generated by Astro from your content files and config.ts. If no content exists yet, TypeScript has nothing to work with.
Fix
Create a content file
Astro needs at least one file in the collection:
src/content/blog/hello-world.md
---
title: "Great title"
pubDate: 2025-10-18
description: "Awesome description"
---
Outstanding post
Define the collection schema
src/content/config.ts
import { defineCollection, z } from "astro:content";
const blogCollection = defineCollection({
schema: z.object({
title: z.string(),
pubDate: z.date(),
description: z.string(),
}),
});
export const collections = {
blog: blogCollection,
};
Run astro sync
npx astro sync
This generates .astro/content.d.ts with all type definitions.
Restart the TypeScript server
In VS Code: Ctrl+Shift+P → TypeScript: Restart TS Server.