* 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 },
)
| 207 | * and core collection's output type without exposing ugly type assertions to users |
| 208 | */ |
| 209 | function 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 | } |
no test coverage detected
searching dependent graphs…