Skip to content

Commit

Permalink
fixup! fix(lint): contract/tools/ui-kit-goals
Browse files Browse the repository at this point in the history
OptionalSlot
  • Loading branch information
mujahidkay committed Oct 1, 2024
1 parent 6021633 commit d6c3167
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions contract/tools/ui-kit-goals/marshalTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Val, string>} */
Expand All @@ -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)) {
Expand All @@ -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}`, {});

Expand Down

0 comments on commit d6c3167

Please sign in to comment.