Each store contains an upgradeTo array for handling version upgrades.
The first entry in the array performs the initial creation of the IndexedDb store:
// Version 1
(db: IDBPDatabase<TVManagerDB>): void => {
const store = db.createObjectStore("episodes", { keyPath: "id" });
/* create indexes etc. */
}
The type of the store constant is implicitly inferred, but can't be explicitly specified, because the signature of the return type of createObjectStore() is:
Each store contains an
upgradeTo
array for handling version upgrades.The first entry in the array performs the initial creation of the IndexedDb store:
The type of the
store
constant is implicitly inferred, but can't be explicitly specified, because the signature of the return type ofcreateObjectStore()
is:...and
StoreNames
(resolves to an array of all valid store names) is not exported byidb
.One workaround would be to explicitly list each store, e.g.
...but that would mean adding a new store in future would break all of these references.