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