Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

isCollection.md

27 lines755 Bytes

1---
2id: isCollection
3title: isCollection
4---
5​
6```ts
7function isCollection(value): value is Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>;
8```
9​
10Defined in: [packages/db/src/live-query-adapter.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/live-query-adapter.ts#L22)
11​
12Structural check for a live-query/`Collection` instance.
13​
14Uses duck typing rather than `instanceof CollectionImpl` on purpose: adapters
15and core can resolve to different copies of `@tanstack/db` (dual-package /
16multi-realm), where `instanceof` gives false negatives. The three methods
17below uniquely identify a Collection.
18​
19## Parameters
20​
21### value
22​
23`unknown`
24​
25## Returns
26​
27`value is Collection<any, any, any, StandardSchemaV1<unknown, unknown>, any>`