Type Alias: RestoreResult
type RestoreResult =
| {
session: PersistedSession;
status: "restored";
}
| {
status: "empty";
}
| {
expected: number;
found: number | undefined;
status: "unsupportedVersion";
}
| {
reason: string;
status: "corrupt";
};
Defined in: packages/media-session/src/persistence.ts:115
What restorePersisted found. A typed result, never a throw: a corrupt
record is an ordinary runtime condition (a half-written file, an app
downgrade, a user clearing storage), and an app that has to try/catch its
cold start will eventually not.
A storage failure is different and does reject — that is a broken dependency, not bad data (CLAUDE.md principle 6).
Union Members
Type Literal
{
session: PersistedSession;
status: "restored";
}
Type Literal
{
status: "empty";
}
Nothing has been saved yet, or clearPersisted was called.
Type Literal
{
expected: number;
found: number | undefined;
status: "unsupportedVersion";
}
Written by a different schema version. found is undefined if it was not a number.
Type Literal
{
reason: string;
status: "corrupt";
}
Unparseable, or parsed but failed the same validation a live broadcast gets.