diff --git a/contract/tools/ui-kit-goals/marshalTables.js b/contract/tools/ui-kit-goals/marshalTables.js index 1d734e79..82220bd4 100644 --- a/contract/tools/ui-kit-goals/marshalTables.js +++ b/contract/tools/ui-kit-goals/marshalTables.js @@ -9,6 +9,12 @@ // @ts-check import { Far, makeMarshal } from '@endo/marshal'; +/** + * The null slot indicates that identity is not intended to be preserved. + * + * @typedef { string | null } OptionalSlot + */ + /** * Implement conventional parts of convertValToSlot, convertSlotToVal functions * for use with makeMarshal based on a slot <-> value translation table, @@ -17,7 +23,7 @@ import { Far, makeMarshal } from '@endo/marshal'; * * @template Val * @param {(val: Val, size: number) => string} makeSlot - * @param {(slot: string | null, iface: string | undefined) => Val} makeVal + * @param {(slot: OptionalSlot, iface: string | undefined) => Val} makeVal */ const makeTranslationTable = (makeSlot, makeVal) => { /** @type {Map} */ @@ -37,7 +43,7 @@ const makeTranslationTable = (makeSlot, makeVal) => { return slot; }; - /** @type {(slot: string | null, iface: string | undefined) => Val} */ + /** @type {(slot: OptionalSlot, iface: string | undefined) => Val} */ const convertSlotToVal = (slot, iface) => { if (slot === null) return makeVal(slot, iface); if (slotToVal.has(slot)) { @@ -53,7 +59,7 @@ const makeTranslationTable = (makeSlot, makeVal) => { return harden({ convertValToSlot, convertSlotToVal }); }; -/** @type {(slot: string | null, iface: string | undefined) => any} */ +/** @type {(slot: OptionalSlot, iface: string | undefined) => any} */ const synthesizeRemotable = (slot, iface) => Far(`${(iface ?? '').replace(/^Alleged: /, '')}#${slot}`, {});