1c9b5a2e83
* Cast proto interface to type ... ... instead of using non-null assertions in Revlog.svelte. * Remove OptionalInt32 and OptionalUInt32
26 lines
727 B
TypeScript
26 lines
727 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
import { anki } from "./backend_proto";
|
|
|
|
import Cards = anki.cards;
|
|
import DeckConfig = anki.deckconfig;
|
|
import Generic = anki.generic;
|
|
import Notetypes = anki.notetypes;
|
|
import Scheduler = anki.scheduler;
|
|
import Stats = anki.stats;
|
|
import Tags = anki.tags;
|
|
|
|
export { Stats, Cards, DeckConfig, Notetypes, Scheduler, Tags };
|
|
|
|
export function unwrapOptionalNumber(
|
|
msg: Generic.IInt64 | Generic.IUInt32 | Generic.IInt32 | null | undefined,
|
|
): number | undefined {
|
|
if (msg && msg !== null) {
|
|
if (msg.val !== null) {
|
|
return msg.val;
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|