TypeScript Types
All public types exported by svelte-idb for full type safety.
Schema types
| Name | Type | Description |
|---|---|---|
DBSchema | Record<string, StoreConfig> | Maps store names to their configuration |
StoreConfig | object | keyPath, autoIncrement, indexes for a store |
IndexConfig | object | keyPath, unique, multiEntry for an index |
DatabaseConfig<T> | object | Full config object passed to createDB |
Store & database types
| Name | Type | Description |
|---|---|---|
IStore<T> | interface | The store interface with all CRUD methods |
Database<T> | type | Mapped type — stores + getRawDB + close |
ReactiveStore<T> | class | Store with liveAll, liveGet, liveCount |
ReactiveDatabase<T> | type | Database with reactive stores + liveQuery |
Reactive types
| Name | Type | Description |
|---|---|---|
ILiveQuery<T> | interface | current, loading, error, refresh(), destroy() |
ChangeEvent | interface | type: 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
| Name | Type | Description |
|---|---|---|
SSRStrategy | 'noop' | 'throw' | function | Controls behavior when IndexedDB is accessed server-side |