Skip to content

Collection utils are untyped for Electric, Trailbase, PowerSync, localOnly collections #1180

@pawelblaszczyk5

Description

@pawelblaszczyk5
  • I've validated the bug against the latest version of DB packages

Describe the bug

Hello 👋

While building app based on Electric I've spotted that utils on collection aren't typed correctly - they fall back to untyped UtilsRecord. Before just reporting it - I verified it for every built-in collection that has custom utils whether it works and found out that it doesn't for a few more collections.

It doesn't have utils (so it works correctly):

  • RxDB collection

It works correctly for:

  • Local Storage collection
  • TanStack Query collection

Utils aren't typed correctly for:

  • Local only collection
  • Electric collection
  • PowerSync collection
  • Trailbase collection

I've created a reproduction including every single of the above collections (except of rxdb which doesn't have custom utils), so it's easy to verify:

https://github.com/pawelblaszczyk5/tanstack-db-missing-collection-utils/blob/main/src/test.ts

Image

As you can see on above screenshot, a few of these has generic UtilsRecord instead of correctly typed ones.

To Reproduce

Steps to reproduce the behavior:

  1. Create Electric/Trailbase/PowerSync/localOnly collection
  2. Try to access utils
  3. Observe them being untyped (they're still there at runtime)

Expected behavior

Collection utils are correctly typed

Screenshots

Provided above

Desktop (please complete the following information):

  • OS: N/A
  • Browser N/A
  • Version N/A

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser N/A
  • Version N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions