Skip to content

Type error when using defineLiveCollection with custom loaders #16012

@Eptagone

Description

@Eptagone

Astro Info

Astro                    v6.0.7
Node                     v22.22.0
System                   Linux (x64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/node
Integrations             none

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

No response

Describe the Bug

The method defineLiveCollection throws the type error {Type} is not assignable to type 'Record<string, unknown>' if your custom live loaders uses an interface to specify the data type.
There're no issues when defining the loader but it fails when passing the loader to defineLiveCollection.
The loader actually works but because the type issue, type definitions are not generated and lint tasks (astro check, eslint, etc) always fails, so you cannot run them before build.

What's the expected result?

The type definitions to work

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-xus3hl1f?file=src%2Flive.config.ts

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions