Types & Config

TypeScript Types

All public types exported by svelte-idb for full type safety.

Schema types

NameTypeDescription
DBSchema Record<string, StoreConfig>Maps store names to their configuration
StoreConfig objectkeyPath, autoIncrement, indexes for a store
IndexConfig objectkeyPath, unique, multiEntry for an index
DatabaseConfig<T> objectFull config object passed to createDB

Store & database types

NameTypeDescription
IStore<T> interfaceThe store interface with all CRUD methods
Database<T> typeMapped type — stores + getRawDB + close
ReactiveStore<T> classStore with liveAll, liveGet, liveCount
ReactiveDatabase<T> typeDatabase with reactive stores + liveQuery

Reactive types

NameTypeDescription
ILiveQuery<T> interfacecurrent, loading, error, refresh(), destroy()
ChangeEvent interfacetype: add | put | delete | clear | batch
ChangeType union'add' | 'put' | 'delete' | 'clear' | 'batch'
ChangeSubscriber function(event: ChangeEvent) => void

Utility types

Helper types for working with records that may or may not have an id field.

utility-types.ts

SSR types

NameTypeDescription
SSRStrategy 'noop' | 'throw' | functionControls behavior when IndexedDB is accessed server-side