Skip to content

TypeScript API / @laikacms/astro/live / liveDocumentsLoader

Function: liveDocumentsLoader() ​

Call Signature ​

ts
function liveDocumentsLoader<K>(options): LiveLoader<LiveCollectionData<K>, LaikaEntryFilter, LaikaCollectionFilter, LaikaError<ErrorCode, number>>;

A live loader over a Laika DocumentsRepository.

When collection names a collection the integration has typed (see live-collections.ts), entry.data comes back as that collection's shape. Otherwise — an untyped collection, or collection omitted so the key is only known at runtime — it stays Record<string, unknown>.

Type Parameters ​

Type Parameter
K extends "posts"

Parameters ​

ParameterType
optionsLiveDocumentsLoaderOptions & object

Returns ​

LiveLoader<LiveCollectionData<K>, LaikaEntryFilter, LaikaCollectionFilter, LaikaError<ErrorCode, number>>

Call Signature ​

ts
function liveDocumentsLoader(options): LiveLoader<Record<string, unknown>, LaikaEntryFilter, LaikaCollectionFilter, LaikaError<ErrorCode, number>>;

A live loader over a Laika DocumentsRepository.

When collection names a collection the integration has typed (see live-collections.ts), entry.data comes back as that collection's shape. Otherwise — an untyped collection, or collection omitted so the key is only known at runtime — it stays Record<string, unknown>.

Parameters ​

ParameterType
optionsLiveDocumentsLoaderOptions

Returns ​

LiveLoader<Record<string, unknown>, LaikaEntryFilter, LaikaCollectionFilter, LaikaError<ErrorCode, number>>

Released under the MIT License.