MCPcopy Index your code
hub / github.com/TanStack/db / bridgeToCreateCollection

Function bridgeToCreateCollection

packages/db/src/query/live-query-collection.ts:209–227  ·  view source on GitHub ↗

* Bridge function that handles the type compatibility between query2's TResult * and core collection's output type without exposing ugly type assertions to users

(
  options: CollectionConfig<TResult> & { utils: TUtils },
)

Source from the content-addressed store, hash-verified

207 * and core collection's output type without exposing ugly type assertions to users
208 */
209function bridgeToCreateCollection<
210 TResult extends object,
211 TUtils extends UtilsRecord = {},
212>(
213 options: CollectionConfig<TResult> & { utils: TUtils },
214): Collection<TResult, string | number, TUtils> {
215 const collection = createCollection(options as any) as unknown as Collection<
216 TResult,
217 string | number,
218 LiveQueryCollectionUtils
219 >
220
221 const builder = getBuilderFromConfig(options)
222 if (builder) {
223 registerCollectionBuilder(collection, builder)
224 }
225
226 return collection as unknown as Collection<TResult, string | number, TUtils>
227}

Callers 1

Calls 3

createCollectionFunction · 0.85
getBuilderFromConfigFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…