Skip to content

Live content collections types are not being generated correctly in dev mode #14238

@wtchnm

Description

@wtchnm

Astro Info

Astro                    v5.13.0
Node                     v20.19.1
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node
Integrations             none

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

No response

Describe the Bug

When running astro dev, live content collections types are being removed from .astro/types.d.ts.

The workaround is run astro dev and then run astro sync in another terminal.

To reproduce:

  1. Run npm run dev.
  2. In another terminal, open the generated types: open .astro/types.d.ts.
  3. Confirm that the /// <reference path="content.d.ts" /> is missing.
  4. Run npm run sync.
  5. The content types reference will be present now.

What's the expected result?

When running astro dev, live content collections types should be generated correctly, without the need of running an external command.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/astro-content-zod-import-bug

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)feat: content collectionsRelated to the Content Collections feature (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions