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

isCollection.md

29 lines783 Bytes

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