Open History to see the last commit
1---
2id: createLiveQueryObserver
3title: createLiveQueryObserver
4---
5
6```ts
7function createLiveQueryObserver<T, TKey>(collection, options): LiveQueryObserver<T, TKey>;
8```
9
10Defined in: [packages/db/src/live-query-observer.ts:1173](https://github.com/TanStack/db/blob/main/packages/db/src/live-query-observer.ts#L1173)
11
12**`Internal`**
13
14Create a [LiveQueryObserver](../interfaces/LiveQueryObserver.md) for a resolved live-query collection, or a
15disabled observer when `collection` is `null`/`undefined`.
16
17 This is an unstable contract shared by TanStack DB's official
18framework adapters. It is exported so the adapter packages can use it, but
19it is not a public extension point yet: its API may change in any release
20without a semver major.
21
22## Type Parameters
23
24### T
25
26`T` *extends* `object`
27
28### TKey
29
30`TKey` *extends* `string` \| `number`
31
32## Parameters
33
34### collection
35
36[`Collection`](../interfaces/Collection.md)\<`T`, `TKey`, `any`, `StandardSchemaV1`\<`unknown`, `unknown`\>, `T`\> | `null` | `undefined`
37
38### options
39
40[`CreateLiveQueryObserverOptions`](../interfaces/CreateLiveQueryObserverOptions.md) = `{}`
41
42## Returns
43
44[`LiveQueryObserver`](../interfaces/LiveQueryObserver.md)\<`T`, `TKey`\>