Skip to content
Source
Sign inSign up
TanStack/db

[fix] findOne returns array instead of single object in angular-db (issue #1261) #1273

Mergedclaude[bot](GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/1273/headmerged by kevin-dp(GitHub profile, opens in a new tab)

Showing 4 changed files with 81 additions and 19 deletions (loading 2).

x
0 of 4 viewed, 4 left
5 additions and 0 deletions.changeset/fix-angular-findone.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/angular-db': patch
+---
+​
+Fix `injectLiveQuery` with `findOne()` returning an array instead of a single object, and add proper type overloads so TypeScript correctly infers `Signal<T | undefined>` for `findOne()` queries
76 additions and 19 deletionspackages/angular-db/src/index.tsModified
View file
@@ -10,12 +10,16 @@
import type {
ChangeMessage,
Collection,
+ CollectionConfigSingleRowOption,
CollectionStatus,
Context,
GetResult,
+ InferResultType,
InitialQueryBuilder,
LiveQueryCollectionConfig,
+ NonSingleResult,
QueryBuilder,
+ SingleResult,
} from '@tanstack/db'
import type { Signal } from '@angular/core'
​