Skip to main content

DataStoreKind Interface

Defines a kind of data store, allowing creating and loading instances of it.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here.

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature

/** @sealed */
export interface DataStoreKind<out T = unknown> extends DataStoreKey<T>, ErasedBaseType<readonly ["DataStoreKind", T]>

Extends: DataStoreKey<T>, ErasedBaseType<readonly ["DataStoreKind", T]>

Type Parameters

ParameterDefaultDescription
TunknownThe API surface that instances of this data store kind expose.

Remarks

A DataStoreKind acts as the factory and type descriptor for a category of data store: it defines the type used to identify the data store in a DataStoreRegistry, and the T API surface that instances of that data store expose.

Provide a DataStoreKind to createContainer(root) or createDataStore(kind) to create new instances, and to loadContainer(id, root) to load existing ones.

A DataStoreKind is not constructed directly. Instead, obtain one from a framework-provided factory: use defineDataStore(options) to define a data store which wraps a root shared object, or use a more specific wrapper around that, such as defineTreeDataStore(options) for a TreeView-backed data store.

Since it implements DataStoreKey, a DataStoreKind can also be used directly as the key to look itself up in a Registry.