From 631d087e291262ce3e798f7a15482c534cb7233b Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Tue, 21 Nov 2023 16:28:25 -0800 Subject: [PATCH 1/5] fix: Import types explicitly throughout --- packages/captp/src/atomics.js | 4 +- packages/captp/src/captp.js | 37 ++- packages/captp/src/trap.js | 8 +- packages/captp/src/types.js | 2 + packages/evasive-transform/src/parse-ast.js | 2 +- packages/exo/src/exo-makers.js | 2 +- packages/exo/src/exo-tools.js | 7 +- packages/marshal/src/types.js | 8 +- packages/patterns/src/keys/compareKeys.js | 2 +- .../src/keys/keycollection-operators.js | 12 +- .../patterns/src/patterns/internal-types.js | 2 + .../patterns/src/patterns/patternMatchers.js | 242 +++++++++--------- 12 files changed, 165 insertions(+), 163 deletions(-) diff --git a/packages/captp/src/atomics.js b/packages/captp/src/atomics.js index 0f4ab37563..f6afda4ff9 100644 --- a/packages/captp/src/atomics.js +++ b/packages/captp/src/atomics.js @@ -49,7 +49,7 @@ const splitTransferBuffer = transferBuffer => { * when the guest iterates over it. * * @param {SharedArrayBuffer} transferBuffer - * @returns {TrapHost} + * @returns {import('./types.js').TrapHost} */ export const makeAtomicsTrapHost = transferBuffer => { const { statusbuf, lenbuf, databuf } = splitTransferBuffer(transferBuffer); @@ -104,7 +104,7 @@ export const makeAtomicsTrapHost = transferBuffer => { * then returns it. * * @param {SharedArrayBuffer} transferBuffer - * @returns {TrapGuest} + * @returns {import('./types.js').TrapGuest} */ export const makeAtomicsTrapGuest = transferBuffer => { const { statusbuf, lenbuf, databuf } = splitTransferBuffer(transferBuffer); diff --git a/packages/captp/src/captp.js b/packages/captp/src/captp.js index e18ecc7c9a..3171aa72ce 100644 --- a/packages/captp/src/captp.js +++ b/packages/captp/src/captp.js @@ -14,7 +14,6 @@ import { isPromise, makePromiseKit } from '@endo/promise-kit'; import { makeTrap } from './trap.js'; -import './types.js'; import { makeFinalizingMap } from './finalize.js'; export { E }; @@ -39,8 +38,8 @@ const isThenable = maybeThenable => * us, we need to reference just our own slot, not one from their * side. * - * @param {CapTPSlot} slot - * @returns {CapTPSlot} slot with direction reversed + * @param {import('./types.js').CapTPSlot} slot + * @returns {import('./types.js').CapTPSlot} slot with direction reversed */ const reverseSlot = slot => { const otherDir = slot[1] === '+' ? '-' : '+'; @@ -50,15 +49,15 @@ const reverseSlot = slot => { /** * @typedef {object} CapTPOptions the options to makeCapTP - * @property {(val: unknown, slot: CapTPSlot) => void} [exportHook] - * @property {(val: unknown, slot: CapTPSlot) => void} [importHook] + * @property {(val: unknown, slot: import('./types.js').CapTPSlot) => void} [exportHook] + * @property {(val: unknown, slot: import('./types.js').CapTPSlot) => void} [importHook] * @property {(err: any) => void} [onReject] * @property {number} [epoch] an integer tag to attach to all messages in order to * assist in ignoring earlier defunct instance's messages - * @property {TrapGuest} [trapGuest] if specified, enable this CapTP (guest) to + * @property {import('./types.js').TrapGuest} [trapGuest] if specified, enable this CapTP (guest) to * use Trap(target) to block while the recipient (host) resolves and * communicates the response to the message - * @property {TrapHost} [trapHost] if specified, enable this CapTP (host) to serve + * @property {import('./types.js').TrapHost} [trapHost] if specified, enable this CapTP (host) to serve * objects marked with makeTrapHandler to synchronous clients (guests) * @property {boolean} [gcImports] if true, aggressively garbage collect imports */ @@ -164,7 +163,7 @@ export const makeCapTP = ( }); }; - /** @type {Map} */ + /** @type {Map} */ const slotToNumRefs = new Map(); const recvSlot = makeRefCounter( @@ -219,13 +218,13 @@ export const makeCapTP = ( }, ); - /** @type {WeakMap} */ + /** @type {WeakMap} */ const valToSlot = new WeakMap(); // exports looked up by val - /** @type {Map} */ + /** @type {Map} */ const slotToExported = new Map(); const slotToImported = makeFinalizingMap( /** - * @param {CapTPSlot} slotID + * @param {import('./types.js').CapTPSlot} slotID */ slotID => { // We drop all the references we know about at once, since GC told us we @@ -246,7 +245,7 @@ export const makeCapTP = ( // Since we decide the ids for questions, we use this to increment the // question key - /** @type {Map>} */ + /** @type {Map>} */ const settlers = new Map(); /** @type {Map} */ const answers = new Map(); // chosen by our peer @@ -257,14 +256,14 @@ export const makeCapTP = ( * promise listener to inform the other side when the promise is * fulfilled/broken. * - * @type {import('@endo/marshal').ConvertValToSlot} + * @type {import('@endo/marshal').ConvertValToSlot} */ function convertValToSlot(val) { if (!valToSlot.has(val)) { /** * new export * - * @type {CapTPSlot} + * @type {import('./types.js').CapTPSlot} */ let slot; if (isPromise(val)) { @@ -327,7 +326,7 @@ export const makeCapTP = ( const IS_REMOTE_PUMPKIN = harden({}); /** - * @type {import('@endo/marshal').ConvertSlotToVal} + * @type {import('@endo/marshal').ConvertSlotToVal} */ const assertValIsLocal = val => { const slot = valToSlot.get(val); @@ -354,7 +353,7 @@ export const makeCapTP = ( * Generate a new question in the questions table and set up a new * remote handled promise. * - * @returns {[CapTPSlot, Promise]} + * @returns {[import('./types.js').CapTPSlot, Promise]} */ const makeQuestion = () => { lastPromiseID += 1; @@ -464,7 +463,7 @@ export const makeCapTP = ( /** * Set up import * - * @type {import('@endo/marshal').ConvertSlotToVal} + * @type {import('@endo/marshal').ConvertSlotToVal} */ function convertSlotToVal(theirSlot, iface = undefined) { let val; @@ -806,7 +805,7 @@ export const makeCapTP = ( serialize, unserialize, makeTrapHandler, - Trap: /** @type {Trap | undefined} */ (undefined), + Trap: /** @type {import('./types.js').Trap | undefined} */ (undefined), }; if (trapGuest) { @@ -904,7 +903,7 @@ export const makeCapTP = ( return value; }; - /** @type {TrapImpl} */ + /** @type {import('./types.js').TrapImpl} */ const trapImpl = { applyFunction: makeTrapImpl('applyFunction'), applyMethod: makeTrapImpl('applyMethod'), diff --git a/packages/captp/src/trap.js b/packages/captp/src/trap.js index 89ea85a8ef..db789935d6 100644 --- a/packages/captp/src/trap.js +++ b/packages/captp/src/trap.js @@ -1,11 +1,9 @@ // Lifted mostly from `@endo/eventual-send/src/E.js`. -import './types.js'; - /** * Default implementation of Trap for near objects. * - * @type {TrapImpl} + * @type {import('./types.js').TrapImpl} */ export const nearTrapImpl = harden({ applyFunction(target, args) { @@ -39,7 +37,7 @@ const baseFreezableProxyHandler = { * A Proxy handler for Trap(x) * * @param {any} x Any value passed to Trap(x) - * @param {TrapImpl} trapImpl + * @param {import('./types.js').TrapImpl} trapImpl * @returns {ProxyHandler} */ const TrapProxyHandler = (x, trapImpl) => { @@ -59,7 +57,7 @@ const TrapProxyHandler = (x, trapImpl) => { }; /** - * @param {TrapImpl} trapImpl + * @param {import('./types.js').TrapImpl} trapImpl * @returns {Trap} */ export const makeTrap = trapImpl => { diff --git a/packages/captp/src/types.js b/packages/captp/src/types.js index 1c8062ca9e..aa68b83103 100644 --- a/packages/captp/src/types.js +++ b/packages/captp/src/types.js @@ -1,3 +1,5 @@ +export {}; + /** @typedef {string} CapTPSlot */ /** diff --git a/packages/evasive-transform/src/parse-ast.js b/packages/evasive-transform/src/parse-ast.js index 30900c1456..9bb74dbe2d 100644 --- a/packages/evasive-transform/src/parse-ast.js +++ b/packages/evasive-transform/src/parse-ast.js @@ -4,7 +4,7 @@ * @module */ -import babelParser from '@babel/parser'; +import * as babelParser from '@babel/parser'; const { parse: parseBabel } = babelParser; diff --git a/packages/exo/src/exo-makers.js b/packages/exo/src/exo-makers.js index a8e7325027..6f51916358 100644 --- a/packages/exo/src/exo-makers.js +++ b/packages/exo/src/exo-makers.js @@ -168,7 +168,7 @@ harden(defineExoClass); * @template {Record} F facet methods * @param {string} tag * @param {{ [K in keyof F]: - * InterfaceGuard<{[M in keyof F[K]]: MethodGuard; }> + * import('@endo/patterns').InterfaceGuard<{[M in keyof F[K]]: import('@endo/patterns').MethodGuard; }> * } | undefined} interfaceGuardKit * @param {I} init * @param {F & { [K in keyof F]: ThisType<{ facets: GuardedKit, state: ReturnType }> }} methodsKit diff --git a/packages/exo/src/exo-tools.js b/packages/exo/src/exo-tools.js index 56fd439968..dfce89f1e7 100644 --- a/packages/exo/src/exo-tools.js +++ b/packages/exo/src/exo-tools.js @@ -49,16 +49,15 @@ const PassableMethodGuard = M.call().rest(M.any()).returns(M.any()); * @property {number} declaredLen * @property {boolean} hasRestArgGuard * @property {boolean} restArgGuardIsRaw - * @property {Pattern} paramsPattern + * @property {import('@endo/patterns').Pattern} paramsPattern * @property {number[]} redactedIndices */ /** - * @param {Passable[]} syncArgs + * @param {import('@endo/pass-style').Passable[]} syncArgs * @param {MatchConfig} matchConfig * @param {string} [label] - * @returns {import('@endo/pass-style').Passable[]} - * Returns the args that should be passed to the raw method. + * @returns {import('@endo/pass-style').Passable[]} Returns the args that should be passed to the raw method. */ const defendSyncArgs = (syncArgs, matchConfig, label = undefined) => { const { diff --git a/packages/marshal/src/types.js b/packages/marshal/src/types.js index 5500d37a81..5a3fbff070 100644 --- a/packages/marshal/src/types.js +++ b/packages/marshal/src/types.js @@ -4,7 +4,7 @@ export {}; /** * @template Slot * @callback ConvertValToSlot - * @param {any} val + * @param {import('@endo/pass-style').PassableCap} val * @returns {Slot} */ @@ -13,7 +13,7 @@ export {}; * @callback ConvertSlotToVal * @param {Slot} slot * @param {import('@endo/pass-style').InterfaceSpec} [iface] - * @returns {any} + * @returns {import('@endo/pass-style').PassableCap} */ /** @@ -84,7 +84,7 @@ export {}; /** * @template Slot * @callback ToCapData - * @param {Passable} val + * @param {import('@endo/pass-style').Passable} val * @returns {CapData} */ @@ -92,7 +92,7 @@ export {}; * @template Slot * @callback FromCapData * @param {CapData} data - * @returns {Passable} + * @returns {import('@endo/pass-style').Passable} */ /** diff --git a/packages/patterns/src/keys/compareKeys.js b/packages/patterns/src/keys/compareKeys.js index b8ee5864e6..7beee3a65a 100644 --- a/packages/patterns/src/keys/compareKeys.js +++ b/packages/patterns/src/keys/compareKeys.js @@ -16,7 +16,7 @@ import { } from './checkKey.js'; import { makeCompareCollection } from './keycollection-operators.js'; -/** @template {Key} [K=Key] @typedef {import('../types').CopySet} CopySet */ +/** @template {import('../types.js').Key} [K=import('../types.js').Key] @typedef {import('../types').CopySet} CopySet */ const { quote: q, Fail } = assert; diff --git a/packages/patterns/src/keys/keycollection-operators.js b/packages/patterns/src/keys/keycollection-operators.js index 84b578c288..8e2b46f465 100644 --- a/packages/patterns/src/keys/keycollection-operators.js +++ b/packages/patterns/src/keys/keycollection-operators.js @@ -21,10 +21,10 @@ const { quote: q, Fail } = assert; * rank, into an iterable that resolves those ties using `fullCompare`. * * @template [V=unknown] - * @param {Array<[Key, V]>} entries + * @param {Array<[import('../types.js').Key, V]>} entries * @param {RankCompare} rankCompare * @param {FullCompare} fullCompare - * @returns {IterableIterator<[Key, V]>} + * @returns {IterableIterator<[import('../types.js').Key, V]>} */ const generateFullSortedEntries = (entries, rankCompare, fullCompare) => { assertRankSorted(entries, rankCompare); @@ -81,9 +81,9 @@ harden(generateFullSortedEntries); * @template [V=unknown] * @param {C} c1 * @param {C} c2 - * @param {(collection: C) => Array<[Key, V]>} getEntries + * @param {(collection: C) => Array<[import('../types.js').Key, V]>} getEntries * @param {any} absentValue - * @returns {IterableIterator<[Key, V | absentValue, V | absentValue]>} + * @returns {IterableIterator<[import('../types.js').Key, V | absentValue, V | absentValue]>} */ export const generateCollectionPairEntries = ( c1, @@ -126,7 +126,7 @@ export const generateCollectionPairEntries = ( nextY(); return makeIterator(() => { let done = false; - /** @type {[Key, V | absentValue, V | absentValue]} */ + /** @type {[import('../types.js').Key, V | absentValue, V | absentValue]} */ let value; if (xDone && yDone) { done = true; @@ -177,7 +177,7 @@ harden(generateCollectionPairEntries); * * @template [C=KeyCollection] * @template [V=unknown] - * @param {(collection: C) => Array<[Key, V]>} getEntries + * @param {(collection: C) => Array<[import('../types.js').Key, V]>} getEntries * @param {any} absentValue * @param {KeyCompare} compareValues * @returns {(left: C, right: C) => KeyComparison} diff --git a/packages/patterns/src/patterns/internal-types.js b/packages/patterns/src/patterns/internal-types.js index 1d15dc41ba..3bcf00bbe3 100644 --- a/packages/patterns/src/patterns/internal-types.js +++ b/packages/patterns/src/patterns/internal-types.js @@ -1,5 +1,7 @@ /// +export {}; + /** @typedef {import('@endo/pass-style').Passable} Passable */ /** @typedef {import('@endo/pass-style').PassStyle} PassStyle */ /** diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index 48978f072a..1960fa6425 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -36,15 +36,13 @@ import { } from '../keys/checkKey.js'; import { generateCollectionPairEntries } from '../keys/keycollection-operators.js'; -import './internal-types.js'; - /// const { quote: q, bare: b, details: X, Fail } = assert; const { entries, values } = Object; const { ownKeys } = Reflect; -/** @type {WeakSet} */ +/** @type {WeakSet} */ const patternMemo = new WeakSet(); // /////////////////////// Match Helpers Helpers ///////////////////////////// @@ -79,11 +77,13 @@ export const defaultLimits = harden({ * Thus, the result only needs to support destructuring. The current * implementation uses inheritance as a cheap hack. * - * @param {Limits} [limits] - * @returns {AllLimits} + * @param {import('./internal-types.js').Limits} [limits] + * @returns {import('./internal-types.js').AllLimits} */ const limit = (limits = {}) => - /** @type {AllLimits} */ (harden({ __proto__: defaultLimits, ...limits })); + /** @type {import('./internal-types.js').AllLimits} */ ( + harden({ __proto__: defaultLimits, ...limits }) + ); const checkIsWellFormedWithLimit = ( payload, @@ -132,7 +132,7 @@ const checkIsWellFormedWithLimit = ( /** * @param {unknown} specimen * @param {number} decimalDigitsLimit - * @param {Checker} check + * @param {import('./internal-types.js').Checker} check */ const checkDecimalDigitsLimit = (specimen, decimalDigitsLimit, check) => { if ( @@ -148,7 +148,7 @@ const checkDecimalDigitsLimit = (specimen, decimalDigitsLimit, check) => { }; /** - * @returns {PatternKit} + * @returns {import('./internal-types.js').PatternKit} */ const makePatternKit = () => { /** @@ -156,7 +156,7 @@ const makePatternKit = () => { * Otherwise result undefined. * * @param {string} tag - * @returns {MatchHelper | undefined} + * @returns {import('./internal-types.js').MatchHelper | undefined} */ const maybeMatchHelper = tag => // eslint-disable-next-line no-use-before-define @@ -168,20 +168,20 @@ const makePatternKit = () => { * to register a payload shape with that meaning, use `MM.undefined()`. * * @param {string} tag - * @returns {Pattern | undefined} + * @returns {import('./internal-types.js').Pattern | undefined} */ const maybePayloadShape = tag => // eslint-disable-next-line no-use-before-define GuardPayloadShapes[tag]; - /** @type {Map} */ + /** @type {Map} */ const singletonKinds = new Map([ ['null', null], ['undefined', undefined], ]); /** - * @type {WeakMap} + * @type {WeakMap} * Only for tagged records of recognized kinds whose store-level invariants * have already been checked. */ @@ -191,9 +191,9 @@ const makePatternKit = () => { * Checks only recognized tags, and only if the tagged * passes the invariants associated with that recognition. * - * @param {Passable} tagged - * @param {Kind} tag - * @param {Checker} check + * @param {import('./internal-types.js').Passable} tagged + * @param {import('./internal-types.js').Kind} tag + * @param {import('./internal-types.js').Checker} check * @returns {boolean} */ const checkTagged = (tagged, tag, check) => { @@ -233,9 +233,9 @@ const makePatternKit = () => { * invariants associated with that recognition. * Otherwise, `check(false, ...)` and returns undefined * - * @param {Passable} specimen - * @param {Checker} [check] - * @returns {Kind | undefined} + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Checker} [check] + * @returns {import('./internal-types.js').Kind | undefined} */ const kindOf = (specimen, check = identChecker) => { const passStyle = passStyleOf(specimen); @@ -264,9 +264,9 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {Passable} specimen - * @param {Kind} kind - * @param {Checker} check + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Kind} kind + * @param {import('./internal-types.js').Checker} check * @returns {boolean} */ const checkKind = (specimen, kind, check) => { @@ -292,16 +292,16 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {Passable} specimen - * @param {Kind} kind + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Kind} kind * @returns {boolean} */ const isKind = (specimen, kind) => checkKind(specimen, kind, identChecker); /** - * @param {Passable} specimen - * @param {Key} keyAsPattern - * @param {Checker} check + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Key} keyAsPattern + * @param {import('./internal-types.js').Checker} check * @returns {boolean} */ const checkAsKeyPatt = (specimen, keyAsPattern, check) => { @@ -318,7 +318,7 @@ const makePatternKit = () => { // /////////////////////// isPattern ///////////////////////////////////////// - /** @type {CheckPattern} */ + /** @type {import('./internal-types.js').CheckPattern} */ const checkPattern = (patt, check) => { if (isKey(patt)) { // All keys are patterns. For these, the keyMemo will do. @@ -339,9 +339,9 @@ const makePatternKit = () => { }; /** - * @param {Passable} patt - known not to be a key, and therefore known + * @param {import('./internal-types.js').Passable} patt - known not to be a key, and therefore known * not to be primitive. - * @param {Checker} check + * @param {import('./internal-types.js').Checker} check * @returns {boolean} */ const checkPatternInternal = (patt, check) => { @@ -388,13 +388,13 @@ const makePatternKit = () => { }; /** - * @param {Passable} patt + * @param {import('./internal-types.js').Passable} patt * @returns {boolean} */ const isPattern = patt => checkPattern(patt, identChecker); /** - * @param {Pattern} patt + * @param {import('./internal-types.js').Pattern} patt */ const assertPattern = patt => { checkPattern(patt, assertChecker); @@ -403,9 +403,9 @@ const makePatternKit = () => { // /////////////////////// matches /////////////////////////////////////////// /** - * @param {Passable} specimen - * @param {Pattern} pattern - * @param {Checker} check + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Pattern} pattern + * @param {import('./internal-types.js').Checker} check * @param {string|number} [label] * @returns {boolean} */ @@ -414,9 +414,9 @@ const makePatternKit = () => { applyLabelingError(checkMatchesInternal, [specimen, pattern, check], label); /** - * @param {Passable} specimen - * @param {Pattern} patt - * @param {Checker} check + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Pattern} patt + * @param {import('./internal-types.js').Checker} check * @returns {boolean} */ const checkMatchesInternal = (specimen, patt, check) => { @@ -562,8 +562,8 @@ const makePatternKit = () => { }; /** - * @param {Passable} specimen - * @param {Pattern} patt + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Pattern} patt * @returns {boolean} */ const matches = (specimen, patt) => @@ -573,8 +573,8 @@ const makePatternKit = () => { * Returning normally indicates success. Match failure is indicated by * throwing. * - * @param {Passable} specimen - * @param {Pattern} patt + * @param {import('./internal-types.js').Passable} specimen + * @param {import('./internal-types.js').Pattern} patt * @param {string|number} [label] */ const mustMatch = (specimen, patt, label = undefined) => { @@ -599,7 +599,7 @@ const makePatternKit = () => { // /////////////////////// getRankCover ////////////////////////////////////// - /** @type {GetRankCover} */ + /** @type {import('./internal-types.js').GetRankCover} */ const getRankCover = (patt, encodePassable) => { if (isKey(patt)) { const encoded = encodePassable(patt); @@ -710,9 +710,9 @@ const makePatternKit = () => { }; /** - * @param {Passable[]} array - * @param {Pattern} patt - * @param {Checker} check + * @param {import('./internal-types.js').Passable[]} array + * @param {import('./internal-types.js').Pattern} patt + * @param {import('./internal-types.js').Checker} check * @param {string} [labelPrefix] * @returns {boolean} */ @@ -728,7 +728,7 @@ const makePatternKit = () => { // /////////////////////// Match Helpers ///////////////////////////////////// - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchAnyHelper = Far('match:any helper', { checkMatches: (_specimen, _matcherPayload, _check) => true, @@ -739,7 +739,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['', '{'], }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchAndHelper = Far('match:and helper', { checkMatches: (specimen, patts, check) => { return patts.every(patt => checkMatches(specimen, patt, check)); @@ -761,7 +761,7 @@ const makePatternKit = () => { ), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchOrHelper = Far('match:or helper', { checkMatches: (specimen, patts, check) => { const { length } = patts; @@ -796,7 +796,7 @@ const makePatternKit = () => { ), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchNotHelper = Far('match:not helper', { checkMatches: (specimen, patt, check) => { if (matches(specimen, patt)) { @@ -814,7 +814,7 @@ const makePatternKit = () => { getRankCover: (_patt, _encodePassable) => ['', '{'], }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchScalarHelper = Far('match:scalar helper', { checkMatches: (specimen, _matcherPayload, check) => checkScalarKey(specimen, check), @@ -824,7 +824,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchKeyHelper = Far('match:key helper', { checkMatches: (specimen, _matcherPayload, check) => checkKey(specimen, check), @@ -834,7 +834,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchPatternHelper = Far('match:pattern helper', { checkMatches: (specimen, _matcherPayload, check) => checkPattern(specimen, check), @@ -844,7 +844,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchKindHelper = Far('match:kind helper', { checkMatches: checkKind, @@ -872,7 +872,7 @@ const makePatternKit = () => { }, }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchBigintHelper = Far('match:bigint helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -894,7 +894,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchNatHelper = Far('match:nat helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -921,7 +921,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchStringHelper = Far('match:string helper', { checkMatches: (specimen, [limits = undefined], check) => { const { stringLengthLimit } = limit(limits); @@ -949,7 +949,7 @@ const makePatternKit = () => { getPassStyleCover('string'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchSymbolHelper = Far('match:symbol helper', { checkMatches: (specimen, [limits = undefined], check) => { const { symbolNameLengthLimit } = limit(limits); @@ -981,7 +981,7 @@ const makePatternKit = () => { getPassStyleCover('symbol'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchRemotableHelper = Far('match:remotable helper', { checkMatches: (specimen, remotableDesc, check) => { if (isKind(specimen, 'remotable')) { @@ -1019,7 +1019,7 @@ const makePatternKit = () => { getPassStyleCover('remotable'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchLTEHelper = Far('match:lte helper', { checkMatches: (specimen, rightOperand, check) => keyLTE(specimen, rightOperand) || @@ -1041,7 +1041,7 @@ const makePatternKit = () => { }, }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchLTHelper = Far('match:lt helper', { checkMatches: (specimen, rightOperand, check) => keyLT(specimen, rightOperand) || @@ -1052,7 +1052,7 @@ const makePatternKit = () => { getRankCover: matchLTEHelper.getRankCover, }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchGTEHelper = Far('match:gte helper', { checkMatches: (specimen, rightOperand, check) => keyGTE(specimen, rightOperand) || @@ -1074,7 +1074,7 @@ const makePatternKit = () => { }, }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchGTHelper = Far('match:gt helper', { checkMatches: (specimen, rightOperand, check) => keyGT(specimen, rightOperand) || @@ -1085,7 +1085,7 @@ const makePatternKit = () => { getRankCover: matchGTEHelper.getRankCover, }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchRecordOfHelper = Far('match:recordOf helper', { checkMatches: ( specimen, @@ -1134,7 +1134,7 @@ const makePatternKit = () => { getRankCover: _entryPatt => getPassStyleCover('copyRecord'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchArrayOfHelper = Far('match:arrayOf helper', { checkMatches: (specimen, [subPatt, limits = undefined], check) => { const { arrayLengthLimit } = limit(limits); @@ -1161,7 +1161,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('copyArray'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchSetOfHelper = Far('match:setOf helper', { checkMatches: (specimen, [keyPatt, limits = undefined], check) => { const { numSetElementsLimit } = limit(limits); @@ -1188,7 +1188,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchBagOfHelper = Far('match:bagOf helper', { checkMatches: ( specimen, @@ -1229,7 +1229,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchMapOfHelper = Far('match:mapOf helper', { checkMatches: ( specimen, @@ -1273,13 +1273,13 @@ const makePatternKit = () => { }); /** - * @param {Passable[]} specimen - * @param {Pattern[]} requiredPatt - * @param {Pattern[]} optionalPatt + * @param {import('./internal-types.js').Passable[]} specimen + * @param {import('./internal-types.js').Pattern[]} requiredPatt + * @param {import('./internal-types.js').Pattern[]} optionalPatt * @returns {{ - * requiredSpecimen: Passable[], - * optionalSpecimen: Passable[], - * restSpecimen: Passable[] + * requiredSpecimen: import('./internal-types.js').Passable[], + * optionalSpecimen: import('./internal-types.js').Passable[], + * restSpecimen: import('./internal-types.js').Passable[] * }} */ const splitArrayParts = (specimen, requiredPatt, optionalPatt) => { @@ -1299,14 +1299,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {Pattern[]} optionalPatt + * @param {import('./internal-types.js').Pattern[]} optionalPatt * @param {number} length - * @returns {Pattern[]} The partialPatt + * @returns {import('./internal-types.js').Pattern[]} The partialPatt */ const adaptArrayPattern = (optionalPatt, length) => harden(optionalPatt.slice(0, length).map(patt => MM.opt(patt))); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchSplitArrayHelper = Far('match:splitArray helper', { checkMatches: ( specimen, @@ -1345,7 +1345,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {Checker} check + * @param {import('./internal-types.js').Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1381,22 +1381,22 @@ const makePatternKit = () => { }); /** - * @param {CopyRecord} specimen - * @param {CopyRecord} requiredPatt - * @param {CopyRecord} optionalPatt + * @param {import('./internal-types.js').CopyRecord} specimen + * @param {import('./internal-types.js').CopyRecord} requiredPatt + * @param {import('./internal-types.js').CopyRecord} optionalPatt * @returns {{ - * requiredSpecimen: CopyRecord, - * optionalSpecimen: CopyRecord, - * restSpecimen: CopyRecord + * requiredSpecimen: import('./internal-types.js').CopyRecord, + * optionalSpecimen: import('./internal-types.js').CopyRecord, + * restSpecimen: import('./internal-types.js').CopyRecord * }} */ const splitRecordParts = (specimen, requiredPatt, optionalPatt) => { // Not frozen! Mutated in place - /** @type {[string, Passable][]} */ + /** @type {[string, import('./internal-types.js').Passable][]} */ const requiredEntries = []; - /** @type {[string, Passable][]} */ + /** @type {[string, import('./internal-types.js').Passable][]} */ const optionalEntries = []; - /** @type {[string, Passable][]} */ + /** @type {[string, import('./internal-types.js').Passable][]} */ const restEntries = []; for (const [name, value] of entries(specimen)) { if (hasOwnPropertyOf(requiredPatt, name)) { @@ -1419,14 +1419,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {CopyRecord} optionalPatt + * @param {import('./internal-types.js').CopyRecord} optionalPatt * @param {string[]} names - * @returns {CopyRecord} The partialPatt + * @returns {import('./internal-types.js').CopyRecord} The partialPatt */ const adaptRecordPattern = (optionalPatt, names) => fromUniqueEntries(names.map(name => [name, MM.opt(optionalPatt[name])])); - /** @type {MatchHelper} */ + /** @type {import('./internal-types.js').MatchHelper} */ const matchSplitRecordHelper = Far('match:splitRecord helper', { checkMatches: ( specimen, @@ -1457,7 +1457,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {Checker} check + * @param {import('./internal-types.js').Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1492,7 +1492,7 @@ const makePatternKit = () => { ]) => getPassStyleCover(passStyleOf(requiredPatt)), }); - /** @type {Record} */ + /** @type {Record} */ const HelpersByMatchTag = harden({ 'match:any': matchAnyHelper, 'match:and': matchAndHelper, @@ -1557,7 +1557,7 @@ const makePatternKit = () => { * payloads array. * * @param {string} tag - * @param {Passable[]} payload + * @param {import('./internal-types.js').Passable[]} payload */ const makeLimitsMatcher = (tag, payload) => { if (payload[payload.length - 1] === undefined) { @@ -1596,7 +1596,7 @@ const makePatternKit = () => { // ////////////////// - /** @type {MatcherNamespace} */ + /** @type {import('./internal-types.js').MatcherNamespace} */ const M = harden({ any: () => AnyShape, and: (...patts) => makeMatcher('match:and', patts), @@ -1744,7 +1744,7 @@ const AwaitArgGuardShape = M.kind('guard:awaitArgGuard'); /** * @param {any} specimen - * @returns {specimen is AwaitArgGuard} + * @returns {specimen is import('./internal-types.js').AwaitArgGuard} */ export const isAwaitArgGuard = specimen => matches(specimen, AwaitArgGuardShape); @@ -1752,7 +1752,7 @@ harden(isAwaitArgGuard); /** * @param {any} specimen - * @returns {asserts specimen is AwaitArgGuard} + * @returns {asserts specimen is import('./internal-types.js').AwaitArgGuard} */ export const assertAwaitArgGuard = specimen => { mustMatch(specimen, AwaitArgGuardShape, 'awaitArgGuard'); @@ -1763,8 +1763,8 @@ harden(assertAwaitArgGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @param {AwaitArgGuard} awaitArgGuard - * @returns {AwaitArgGuardPayload} + * @param {import('./internal-types.js').AwaitArgGuard} awaitArgGuard + * @returns {import('./internal-types.js').AwaitArgGuardPayload} */ export const getAwaitArgGuardPayload = awaitArgGuard => { assertAwaitArgGuard(awaitArgGuard); @@ -1773,11 +1773,11 @@ export const getAwaitArgGuardPayload = awaitArgGuard => { harden(getAwaitArgGuardPayload); /** - * @param {Pattern} argPattern - * @returns {AwaitArgGuard} + * @param {import('./internal-types.js').Pattern} argPattern + * @returns {import('./internal-types.js').AwaitArgGuard} */ const makeAwaitArgGuard = argPattern => { - /** @type {AwaitArgGuard} */ + /** @type {import('./internal-types.js').AwaitArgGuard} */ const result = makeTagged('guard:awaitArgGuard', { argGuard: argPattern, }); @@ -1797,7 +1797,7 @@ export const assertRawGuard = specimen => mustMatch(specimen, RawGuardShape, 'rawGuard'); /** - * @returns {import('../types.js').RawGuard} + * @returns {import('./internal-types.js').RawGuard} */ const makeRawGuard = () => makeTagged('guard:rawGuard', {}); @@ -1836,7 +1836,7 @@ const MethodGuardShape = M.kind('guard:methodGuard'); /** * @param {any} specimen - * @returns {asserts specimen is MethodGuard} + * @returns {asserts specimen is import('./internal-types.js').MethodGuard} */ export const assertMethodGuard = specimen => { mustMatch(specimen, MethodGuardShape, 'methodGuard'); @@ -1847,8 +1847,8 @@ harden(assertMethodGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @param {MethodGuard} methodGuard - * @returns {MethodGuardPayload} + * @param {import('./internal-types.js').MethodGuard} methodGuard + * @returns {import('./internal-types.js').MethodGuardPayload} */ export const getMethodGuardPayload = methodGuard => { assertMethodGuard(methodGuard); @@ -1858,10 +1858,10 @@ harden(getMethodGuardPayload); /** * @param {'sync'|'async'} callKind - * @param {ArgGuard[]} argGuards - * @param {ArgGuard[]} [optionalArgGuards] - * @param {SyncValueGuard} [restArgGuard] - * @returns {MethodGuardMaker} + * @param {import('./internal-types.js').ArgGuard[]} argGuards + * @param {import('./internal-types.js').ArgGuard[]} [optionalArgGuards] + * @param {import('./internal-types.js').SyncValueGuard} [restArgGuard] + * @returns {import('./internal-types.js').MethodGuardMaker} */ const makeMethodGuardMaker = ( callKind, @@ -1887,7 +1887,7 @@ const makeMethodGuardMaker = ( ); }, returns: (returnGuard = M.undefined()) => { - /** @type {MethodGuard} */ + /** @type {import('./internal-types.js').MethodGuard} */ const result = makeTagged('guard:methodGuard', { callKind, argGuards, @@ -1916,7 +1916,7 @@ const InterfaceGuardShape = M.kind('guard:interfaceGuard'); /** * @param {any} specimen - * @returns {asserts specimen is InterfaceGuard} + * @returns {asserts specimen is import('./internal-types.js').InterfaceGuard} */ export const assertInterfaceGuard = specimen => { mustMatch(specimen, InterfaceGuardShape, 'interfaceGuard'); @@ -1927,9 +1927,9 @@ harden(assertInterfaceGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @template {Record} [T=Record] - * @param {InterfaceGuard} interfaceGuard - * @returns {InterfaceGuardPayload} + * @template {Record} [T=Record] + * @param {import('./internal-types.js').InterfaceGuard} interfaceGuard + * @returns {import('./internal-types.js').InterfaceGuardPayload} */ export const getInterfaceGuardPayload = interfaceGuard => { assertInterfaceGuard(interfaceGuard); @@ -1940,7 +1940,7 @@ harden(getInterfaceGuardPayload); const emptyCopyMap = makeCopyMap([]); /** - * @param {InterfaceGuard} interfaceGuard + * @param {import('./internal-types.js').InterfaceGuard} interfaceGuard * @returns {(string | symbol)[]} */ export const getInterfaceMethodKeys = interfaceGuard => { @@ -1957,11 +1957,11 @@ export const getInterfaceMethodKeys = interfaceGuard => { harden(getInterfaceMethodKeys); /** - * @template {Record} [M = Record] + * @template {Record} [M = Record] * @param {string} interfaceName * @param {M} methodGuards * @param {{ sloppy?: boolean, defaultGuards?: import('../types.js').DefaultGuardType }} [options] - * @returns {InterfaceGuard} + * @returns {import('./internal-types.js').InterfaceGuard} */ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { const { sloppy = false, defaultGuards = sloppy ? 'passable' : undefined } = @@ -1969,9 +1969,9 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { // For backwards compatibility, string-keyed method guards are represented in // a CopyRecord. But symbol-keyed methods cannot be, so we put those in a // CopyMap when present. - /** @type {Record} */ + /** @type {Record} */ const stringMethodGuards = {}; - /** @type {Array<[symbol, MethodGuard]>} */ + /** @type {Array<[symbol, import('./internal-types.js').MethodGuard]>} */ const symbolMethodGuardsEntries = []; for (const key of ownKeys(methodGuards)) { const value = methodGuards[/** @type {string} */ (key)]; @@ -1981,7 +1981,7 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { stringMethodGuards[key] = value; } } - /** @type {InterfaceGuard} */ + /** @type {import('./internal-types.js').InterfaceGuard} */ const result = makeTagged('guard:interfaceGuard', { interfaceName, methodGuards: stringMethodGuards, @@ -1991,7 +1991,9 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { defaultGuards, }); assertInterfaceGuard(result); - return /** @type {InterfaceGuard} */ (result); + return /** @type {import('./internal-types.js').InterfaceGuard} */ ( + result + ); }; const GuardPayloadShapes = harden({ From 9465be369e53167815ca444f6293a8e9eb48501d Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Tue, 21 Nov 2023 17:01:56 -0800 Subject: [PATCH 2/5] fix: Adjust type generation in release process and CI --- .github/workflows/ci.yml | 10 ++++++++-- CONTRIBUTING.md | 16 ++++++++++++++++ packages/base64/package.json | 4 ++-- packages/bundle-source/package.json | 4 ++-- packages/captp/package.json | 4 ++-- packages/check-bundle/package.json | 4 ++-- packages/cjs-module-analyzer/package.json | 4 ++-- packages/cli/package.json | 4 ++-- packages/compartment-mapper/package.json | 4 ++-- packages/daemon/package.json | 4 ++-- packages/env-options/package.json | 4 ++-- packages/errors/package.json | 4 ++-- packages/evasive-transform/package.json | 5 ++--- packages/eventual-send/package.json | 4 ++-- packages/exo/package.json | 4 ++-- packages/far/package.json | 4 ++-- packages/import-bundle/package.json | 4 ++-- packages/init/package.json | 4 ++-- packages/lp32/package.json | 4 ++-- packages/marshal/package.json | 4 ++-- packages/memoize/package.json | 4 ++-- packages/netstring/package.json | 4 ++-- packages/pass-style/package.json | 4 ++-- packages/patterns/package.json | 4 ++-- packages/promise-kit/package.json | 4 ++-- packages/ses-ava/package.json | 4 ++-- packages/skel/package.json | 5 ++--- packages/static-module-record/package.json | 4 ++-- packages/stream-node/package.json | 4 ++-- packages/stream/package.json | 4 ++-- packages/syrup/package.json | 4 ++-- packages/where/package.json | 4 ++-- packages/zip/package.json | 4 ++-- 33 files changed, 86 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2acd9d10a0..2b22267217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -401,6 +401,12 @@ jobs: - name: build run: yarn run build + - name: build:types + run: yarn lerna run build:types + - name: pack - # Concurrency is 1 to avoid bizarre cross-package contamination. - run: yarn run lerna exec --concurrency=1 yarn pack + # Cannot use yarn lerna run pack + run: yarn lerna exec yarn pack + + - name: clean:types + run: yarn lerna run clean:types diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b353f62e78..b85c50e19b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,16 @@ https://github.com/endojs/endo/labels/next-release git checkout -b release-$now ``` +* Generate types. + + ```sh + yarn lerna run build:types + ``` + + We generate types from the bottom up before publishing because this allows + each package to rely on the generated types of its dependencies in the + workspace. + * Create the release CHANGELOGs. ```sh @@ -156,6 +166,12 @@ https://github.com/endojs/endo/labels/next-release git tag -l | egrep -e '@[0-9]+\.[0-9]+\.[0-9]+$' | xargs git push origin ``` +* Clean up generated types. + + ```sh + yarn lerna run clean:types + ``` + ## More information To get help for the command-line options that will affect these commands, use: diff --git a/packages/base64/package.json b/packages/base64/package.json index 431a6f6006..2a6c6753f0 100644 --- a/packages/base64/package.json +++ b/packages/base64/package.json @@ -31,8 +31,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/bundle-source/package.json b/packages/bundle-source/package.json index c5a433a8ea..3a1f569ac7 100644 --- a/packages/bundle-source/package.json +++ b/packages/bundle-source/package.json @@ -15,8 +15,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava", "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", diff --git a/packages/captp/package.json b/packages/captp/package.json index a44ebed040..3e85c618fb 100644 --- a/packages/captp/package.json +++ b/packages/captp/package.json @@ -30,8 +30,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava", "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", diff --git a/packages/check-bundle/package.json b/packages/check-bundle/package.json index cb5825b536..aa6b25bdcc 100644 --- a/packages/check-bundle/package.json +++ b/packages/check-bundle/package.json @@ -29,8 +29,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", "lint:js": "eslint .", diff --git a/packages/cjs-module-analyzer/package.json b/packages/cjs-module-analyzer/package.json index deda765a11..24647d4914 100644 --- a/packages/cjs-module-analyzer/package.json +++ b/packages/cjs-module-analyzer/package.json @@ -21,8 +21,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/cli/package.json b/packages/cli/package.json index a558f25719..803f399296 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -17,8 +17,8 @@ "exports": {}, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", "lint:js": "eslint .", diff --git a/packages/compartment-mapper/package.json b/packages/compartment-mapper/package.json index bdf394351e..23525b8b1e 100644 --- a/packages/compartment-mapper/package.json +++ b/packages/compartment-mapper/package.json @@ -35,8 +35,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/daemon/package.json b/packages/daemon/package.json index b6b4322408..f6eec04486 100644 --- a/packages/daemon/package.json +++ b/packages/daemon/package.json @@ -29,8 +29,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/env-options/package.json b/packages/env-options/package.json index 59e73ba0aa..c98147c47d 100644 --- a/packages/env-options/package.json +++ b/packages/env-options/package.json @@ -30,8 +30,8 @@ "lint-fix": "eslint --fix .", "lint:js": "eslint .", "lint:types": "tsc", - "postpack": "git clean -f '*.d.ts*'", - "prepack": "tsc --build tsconfig.build.json", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava" }, "devDependencies": { diff --git a/packages/errors/package.json b/packages/errors/package.json index 8175d13c38..96507220e5 100644 --- a/packages/errors/package.json +++ b/packages/errors/package.json @@ -28,8 +28,8 @@ "lint-fix": "yarn lint:eslint --fix && yarn lint:types", "lint:eslint": "eslint '**/*.js'", "lint:types": "tsc", - "postpack": "yarn clean", - "prepack": "tsc --build tsconfig.build.json", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava", "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0" diff --git a/packages/evasive-transform/package.json b/packages/evasive-transform/package.json index ee1201e572..4df1acdba9 100644 --- a/packages/evasive-transform/package.json +++ b/packages/evasive-transform/package.json @@ -25,9 +25,8 @@ "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", "build": "exit 0", - "clean": "git clean -f '*.d.ts*'", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "yarn clean", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint-fix": "yarn lint:eslint --fix && yarn lint:types", "lint-check": "yarn lint", "lint": "yarn lint:types && yarn lint:eslint", diff --git a/packages/eventual-send/package.json b/packages/eventual-send/package.json index 388018c587..1c2bad5dd0 100644 --- a/packages/eventual-send/package.json +++ b/packages/eventual-send/package.json @@ -10,8 +10,8 @@ "test:xs": "exit 0", "build": "exit 0", "clean": "git clean -f '*.d.ts*'", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "yarn clean", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint-fix": "yarn lint:eslint --fix && yarn lint:types", "lint-check": "yarn lint", "lint": "yarn lint:types && yarn lint:eslint", diff --git a/packages/exo/package.json b/packages/exo/package.json index 7d689f7aa2..9b7c4cc0ea 100644 --- a/packages/exo/package.json +++ b/packages/exo/package.json @@ -23,8 +23,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", "lint:js": "eslint .", diff --git a/packages/far/package.json b/packages/far/package.json index 43ae0f79fb..e7bc984b21 100644 --- a/packages/far/package.json +++ b/packages/far/package.json @@ -9,8 +9,8 @@ "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint-fix": "yarn lint:eslint --fix && yarn lint:types", "lint-check": "yarn lint", "lint": "yarn lint:types && yarn lint:eslint", diff --git a/packages/import-bundle/package.json b/packages/import-bundle/package.json index e677c1ced0..d99acb2a8a 100644 --- a/packages/import-bundle/package.json +++ b/packages/import-bundle/package.json @@ -19,8 +19,8 @@ "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint-fix": "eslint --fix '**/*.js'", "lint": "yarn lint:types && yarn lint:eslint", "lint:eslint": "eslint .", diff --git a/packages/init/package.json b/packages/init/package.json index e59a6ab67e..8a146c5e2a 100644 --- a/packages/init/package.json +++ b/packages/init/package.json @@ -19,8 +19,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava", "test:xs": "exit 0", "lint-check": "yarn lint", diff --git a/packages/lp32/package.json b/packages/lp32/package.json index 8cd3b71a08..dffdc7f926 100644 --- a/packages/lp32/package.json +++ b/packages/lp32/package.json @@ -39,8 +39,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/marshal/package.json b/packages/marshal/package.json index ddf2c5334f..027daf760d 100644 --- a/packages/marshal/package.json +++ b/packages/marshal/package.json @@ -9,8 +9,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava", "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", diff --git a/packages/memoize/package.json b/packages/memoize/package.json index d1f934f22d..c987c56ab8 100644 --- a/packages/memoize/package.json +++ b/packages/memoize/package.json @@ -30,8 +30,8 @@ "lint-fix": "eslint --fix .", "lint:js": "eslint .", "lint:types": "tsc", - "postpack": "git clean -f '*.d.ts*'", - "prepack": "tsc --build tsconfig.build.json", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "test": "ava" }, "dependencies": { diff --git a/packages/netstring/package.json b/packages/netstring/package.json index e1ed83d6df..c2dc24a8c1 100644 --- a/packages/netstring/package.json +++ b/packages/netstring/package.json @@ -24,8 +24,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/pass-style/package.json b/packages/pass-style/package.json index 2eb01e3300..88d85b4d1a 100644 --- a/packages/pass-style/package.json +++ b/packages/pass-style/package.json @@ -24,8 +24,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", "lint:js": "eslint .", diff --git a/packages/patterns/package.json b/packages/patterns/package.json index eef7503eed..dd40aa8784 100644 --- a/packages/patterns/package.json +++ b/packages/patterns/package.json @@ -22,8 +22,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", "lint:js": "eslint .", diff --git a/packages/promise-kit/package.json b/packages/promise-kit/package.json index 7d4c716f39..d8f0463f6d 100644 --- a/packages/promise-kit/package.json +++ b/packages/promise-kit/package.json @@ -25,8 +25,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-check": "yarn lint", diff --git a/packages/ses-ava/package.json b/packages/ses-ava/package.json index c256b61bf3..4e99caa2c5 100644 --- a/packages/ses-ava/package.json +++ b/packages/ses-ava/package.json @@ -25,8 +25,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/skel/package.json b/packages/skel/package.json index acbc55571c..7cf308a384 100644 --- a/packages/skel/package.json +++ b/packages/skel/package.json @@ -26,9 +26,8 @@ "test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", "test:xs": "exit 0", "build": "exit 0", - "clean": "git clean -f '*.d.ts*'", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "yarn clean", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "lint-fix": "yarn lint:eslint --fix && yarn lint:types", "lint-check": "yarn lint", "lint": "yarn lint:types && yarn lint:eslint", diff --git a/packages/static-module-record/package.json b/packages/static-module-record/package.json index a68997317e..bbeae2f623 100644 --- a/packages/static-module-record/package.json +++ b/packages/static-module-record/package.json @@ -26,8 +26,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint:types": "tsc", diff --git a/packages/stream-node/package.json b/packages/stream-node/package.json index 8e79e960ba..794e4ba352 100644 --- a/packages/stream-node/package.json +++ b/packages/stream-node/package.json @@ -30,8 +30,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/stream/package.json b/packages/stream/package.json index c8bd3bfa3e..aa9328dfcc 100644 --- a/packages/stream/package.json +++ b/packages/stream/package.json @@ -33,8 +33,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/syrup/package.json b/packages/syrup/package.json index 96285b9705..fcafa18b4b 100644 --- a/packages/syrup/package.json +++ b/packages/syrup/package.json @@ -28,8 +28,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/where/package.json b/packages/where/package.json index d964fd31e3..14558b7450 100644 --- a/packages/where/package.json +++ b/packages/where/package.json @@ -26,8 +26,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", diff --git a/packages/zip/package.json b/packages/zip/package.json index a1d39c4348..aef97e4bbd 100644 --- a/packages/zip/package.json +++ b/packages/zip/package.json @@ -27,8 +27,8 @@ }, "scripts": { "build": "exit 0", - "prepack": "tsc --build tsconfig.build.json", - "postpack": "git clean -f '*.d.ts*'", + "build:types": "tsc --build tsconfig.build.json", + "clean:types": "git clean -f '*.d.ts*'", "cover": "c8 ava", "lint": "yarn lint:types && yarn lint:js", "lint-fix": "eslint --fix .", From 75c26fb971b381a1f6e303a9d8cb4b0883c37102 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 27 Nov 2023 16:02:35 -0800 Subject: [PATCH 3/5] fix(pass-style): Make __getMethodNames__ non-enumerable --- packages/pass-style/src/make-far.js | 9 ++++++++- packages/pass-style/test/test-passStyleOf.js | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/pass-style/src/make-far.js b/packages/pass-style/src/make-far.js index 0b7b0916b0..1e92acbbc3 100644 --- a/packages/pass-style/src/make-far.js +++ b/packages/pass-style/src/make-far.js @@ -157,6 +157,13 @@ const getMethodNamesMethod = harden({ }, })[GET_METHOD_NAMES]; +const getMethodNamesDescriptor = harden({ + value: getMethodNamesMethod, + enumerable: false, + configurable: false, + writable: false, +}); + /** * A concise convenience for the most common `Remotable` use. * @@ -179,7 +186,7 @@ export const Far = (farName, remotable = undefined) => { // * does further mutations, // * hardens the mutated object before returning it. // so this mutation is not unprecedented. But it is surprising! - r[GET_METHOD_NAMES] = getMethodNamesMethod; + Object.defineProperty(r, GET_METHOD_NAMES, getMethodNamesDescriptor); } return Remotable(`Alleged: ${farName}`, undefined, r); }; diff --git a/packages/pass-style/test/test-passStyleOf.js b/packages/pass-style/test/test-passStyleOf.js index ea6610e5af..9acf2cf6a7 100644 --- a/packages/pass-style/test/test-passStyleOf.js +++ b/packages/pass-style/test/test-passStyleOf.js @@ -266,8 +266,7 @@ test('passStyleOf testing remotables', t => { class NonFarBaseClass9 {} class Subclass9 extends NonFarBaseClass9 {} t.throws(() => Far('FarType9', Subclass9.prototype), { - message: - 'For now, remotables cannot inherit from anything unusual, in {"__getMethodNames__":"[Function __getMethodNames__]"}', + message: 'For now, remotables cannot inherit from anything unusual, in {}', }); const unusualTagRecordProtoMessage = From 64e109997c4d1d67c2643c6d5f8c890cdb31df7e Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Thu, 7 Dec 2023 15:19:00 -0800 Subject: [PATCH 4/5] fix(exo): Relax requirement on implementation of __getInterfaceGuard__ method --- packages/exo/src/get-interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/exo/src/get-interface.js b/packages/exo/src/get-interface.js index 1657cf3c53..9c13188114 100644 --- a/packages/exo/src/get-interface.js +++ b/packages/exo/src/get-interface.js @@ -18,7 +18,7 @@ export const GET_INTERFACE_GUARD = '__getInterfaceGuard__'; /** * @template {Record} M * @typedef {{ - * [GET_INTERFACE_GUARD]: () => + * [GET_INTERFACE_GUARD]?: () => * import('@endo/patterns').InterfaceGuard<{ * [K in keyof M]: import('@endo/patterns').MethodGuard * }> | undefined From b7f18a790fc5f8181c3712c8a074fa26e108edb9 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 11 Dec 2023 13:26:26 -0800 Subject: [PATCH 5/5] refactor(patterns): Rename internal-types.js to types.js --- .../patterns/src/patterns/patternMatchers.js | 238 +++++++++--------- .../patterns/{internal-types.js => types.js} | 0 2 files changed, 118 insertions(+), 120 deletions(-) rename packages/patterns/src/patterns/{internal-types.js => types.js} (100%) diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index 1960fa6425..054d79679f 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -42,7 +42,7 @@ const { quote: q, bare: b, details: X, Fail } = assert; const { entries, values } = Object; const { ownKeys } = Reflect; -/** @type {WeakSet} */ +/** @type {WeakSet} */ const patternMemo = new WeakSet(); // /////////////////////// Match Helpers Helpers ///////////////////////////// @@ -77,11 +77,11 @@ export const defaultLimits = harden({ * Thus, the result only needs to support destructuring. The current * implementation uses inheritance as a cheap hack. * - * @param {import('./internal-types.js').Limits} [limits] - * @returns {import('./internal-types.js').AllLimits} + * @param {import('./types.js').Limits} [limits] + * @returns {import('./types.js').AllLimits} */ const limit = (limits = {}) => - /** @type {import('./internal-types.js').AllLimits} */ ( + /** @type {import('./types.js').AllLimits} */ ( harden({ __proto__: defaultLimits, ...limits }) ); @@ -132,7 +132,7 @@ const checkIsWellFormedWithLimit = ( /** * @param {unknown} specimen * @param {number} decimalDigitsLimit - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Checker} check */ const checkDecimalDigitsLimit = (specimen, decimalDigitsLimit, check) => { if ( @@ -148,7 +148,7 @@ const checkDecimalDigitsLimit = (specimen, decimalDigitsLimit, check) => { }; /** - * @returns {import('./internal-types.js').PatternKit} + * @returns {import('./types.js').PatternKit} */ const makePatternKit = () => { /** @@ -156,7 +156,7 @@ const makePatternKit = () => { * Otherwise result undefined. * * @param {string} tag - * @returns {import('./internal-types.js').MatchHelper | undefined} + * @returns {import('./types.js').MatchHelper | undefined} */ const maybeMatchHelper = tag => // eslint-disable-next-line no-use-before-define @@ -168,20 +168,20 @@ const makePatternKit = () => { * to register a payload shape with that meaning, use `MM.undefined()`. * * @param {string} tag - * @returns {import('./internal-types.js').Pattern | undefined} + * @returns {import('./types.js').Pattern | undefined} */ const maybePayloadShape = tag => // eslint-disable-next-line no-use-before-define GuardPayloadShapes[tag]; - /** @type {Map} */ + /** @type {Map} */ const singletonKinds = new Map([ ['null', null], ['undefined', undefined], ]); /** - * @type {WeakMap} + * @type {WeakMap} * Only for tagged records of recognized kinds whose store-level invariants * have already been checked. */ @@ -191,9 +191,9 @@ const makePatternKit = () => { * Checks only recognized tags, and only if the tagged * passes the invariants associated with that recognition. * - * @param {import('./internal-types.js').Passable} tagged - * @param {import('./internal-types.js').Kind} tag - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable} tagged + * @param {import('./types.js').Kind} tag + * @param {import('./types.js').Checker} check * @returns {boolean} */ const checkTagged = (tagged, tag, check) => { @@ -233,9 +233,9 @@ const makePatternKit = () => { * invariants associated with that recognition. * Otherwise, `check(false, ...)` and returns undefined * - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Checker} [check] - * @returns {import('./internal-types.js').Kind | undefined} + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Checker} [check] + * @returns {import('./types.js').Kind | undefined} */ const kindOf = (specimen, check = identChecker) => { const passStyle = passStyleOf(specimen); @@ -264,9 +264,9 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Kind} kind - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Kind} kind + * @param {import('./types.js').Checker} check * @returns {boolean} */ const checkKind = (specimen, kind, check) => { @@ -292,16 +292,16 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Kind} kind + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Kind} kind * @returns {boolean} */ const isKind = (specimen, kind) => checkKind(specimen, kind, identChecker); /** - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Key} keyAsPattern - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Key} keyAsPattern + * @param {import('./types.js').Checker} check * @returns {boolean} */ const checkAsKeyPatt = (specimen, keyAsPattern, check) => { @@ -318,7 +318,7 @@ const makePatternKit = () => { // /////////////////////// isPattern ///////////////////////////////////////// - /** @type {import('./internal-types.js').CheckPattern} */ + /** @type {import('./types.js').CheckPattern} */ const checkPattern = (patt, check) => { if (isKey(patt)) { // All keys are patterns. For these, the keyMemo will do. @@ -339,9 +339,9 @@ const makePatternKit = () => { }; /** - * @param {import('./internal-types.js').Passable} patt - known not to be a key, and therefore known + * @param {import('./types.js').Passable} patt - known not to be a key, and therefore known * not to be primitive. - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Checker} check * @returns {boolean} */ const checkPatternInternal = (patt, check) => { @@ -388,13 +388,13 @@ const makePatternKit = () => { }; /** - * @param {import('./internal-types.js').Passable} patt + * @param {import('./types.js').Passable} patt * @returns {boolean} */ const isPattern = patt => checkPattern(patt, identChecker); /** - * @param {import('./internal-types.js').Pattern} patt + * @param {import('./types.js').Pattern} patt */ const assertPattern = patt => { checkPattern(patt, assertChecker); @@ -403,9 +403,9 @@ const makePatternKit = () => { // /////////////////////// matches /////////////////////////////////////////// /** - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Pattern} pattern - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Pattern} pattern + * @param {import('./types.js').Checker} check * @param {string|number} [label] * @returns {boolean} */ @@ -414,9 +414,9 @@ const makePatternKit = () => { applyLabelingError(checkMatchesInternal, [specimen, pattern, check], label); /** - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Pattern} patt - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Pattern} patt + * @param {import('./types.js').Checker} check * @returns {boolean} */ const checkMatchesInternal = (specimen, patt, check) => { @@ -562,8 +562,8 @@ const makePatternKit = () => { }; /** - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Pattern} patt + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Pattern} patt * @returns {boolean} */ const matches = (specimen, patt) => @@ -573,8 +573,8 @@ const makePatternKit = () => { * Returning normally indicates success. Match failure is indicated by * throwing. * - * @param {import('./internal-types.js').Passable} specimen - * @param {import('./internal-types.js').Pattern} patt + * @param {import('./types.js').Passable} specimen + * @param {import('./types.js').Pattern} patt * @param {string|number} [label] */ const mustMatch = (specimen, patt, label = undefined) => { @@ -599,7 +599,7 @@ const makePatternKit = () => { // /////////////////////// getRankCover ////////////////////////////////////// - /** @type {import('./internal-types.js').GetRankCover} */ + /** @type {import('./types.js').GetRankCover} */ const getRankCover = (patt, encodePassable) => { if (isKey(patt)) { const encoded = encodePassable(patt); @@ -710,9 +710,9 @@ const makePatternKit = () => { }; /** - * @param {import('./internal-types.js').Passable[]} array - * @param {import('./internal-types.js').Pattern} patt - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Passable[]} array + * @param {import('./types.js').Pattern} patt + * @param {import('./types.js').Checker} check * @param {string} [labelPrefix] * @returns {boolean} */ @@ -728,7 +728,7 @@ const makePatternKit = () => { // /////////////////////// Match Helpers ///////////////////////////////////// - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchAnyHelper = Far('match:any helper', { checkMatches: (_specimen, _matcherPayload, _check) => true, @@ -739,7 +739,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['', '{'], }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchAndHelper = Far('match:and helper', { checkMatches: (specimen, patts, check) => { return patts.every(patt => checkMatches(specimen, patt, check)); @@ -761,7 +761,7 @@ const makePatternKit = () => { ), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchOrHelper = Far('match:or helper', { checkMatches: (specimen, patts, check) => { const { length } = patts; @@ -796,7 +796,7 @@ const makePatternKit = () => { ), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchNotHelper = Far('match:not helper', { checkMatches: (specimen, patt, check) => { if (matches(specimen, patt)) { @@ -814,7 +814,7 @@ const makePatternKit = () => { getRankCover: (_patt, _encodePassable) => ['', '{'], }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchScalarHelper = Far('match:scalar helper', { checkMatches: (specimen, _matcherPayload, check) => checkScalarKey(specimen, check), @@ -824,7 +824,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchKeyHelper = Far('match:key helper', { checkMatches: (specimen, _matcherPayload, check) => checkKey(specimen, check), @@ -834,7 +834,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchPatternHelper = Far('match:pattern helper', { checkMatches: (specimen, _matcherPayload, check) => checkPattern(specimen, check), @@ -844,7 +844,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchKindHelper = Far('match:kind helper', { checkMatches: checkKind, @@ -872,7 +872,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchBigintHelper = Far('match:bigint helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -894,7 +894,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchNatHelper = Far('match:nat helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -921,7 +921,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchStringHelper = Far('match:string helper', { checkMatches: (specimen, [limits = undefined], check) => { const { stringLengthLimit } = limit(limits); @@ -949,7 +949,7 @@ const makePatternKit = () => { getPassStyleCover('string'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchSymbolHelper = Far('match:symbol helper', { checkMatches: (specimen, [limits = undefined], check) => { const { symbolNameLengthLimit } = limit(limits); @@ -981,7 +981,7 @@ const makePatternKit = () => { getPassStyleCover('symbol'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchRemotableHelper = Far('match:remotable helper', { checkMatches: (specimen, remotableDesc, check) => { if (isKind(specimen, 'remotable')) { @@ -1019,7 +1019,7 @@ const makePatternKit = () => { getPassStyleCover('remotable'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchLTEHelper = Far('match:lte helper', { checkMatches: (specimen, rightOperand, check) => keyLTE(specimen, rightOperand) || @@ -1041,7 +1041,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchLTHelper = Far('match:lt helper', { checkMatches: (specimen, rightOperand, check) => keyLT(specimen, rightOperand) || @@ -1052,7 +1052,7 @@ const makePatternKit = () => { getRankCover: matchLTEHelper.getRankCover, }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchGTEHelper = Far('match:gte helper', { checkMatches: (specimen, rightOperand, check) => keyGTE(specimen, rightOperand) || @@ -1074,7 +1074,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchGTHelper = Far('match:gt helper', { checkMatches: (specimen, rightOperand, check) => keyGT(specimen, rightOperand) || @@ -1085,7 +1085,7 @@ const makePatternKit = () => { getRankCover: matchGTEHelper.getRankCover, }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchRecordOfHelper = Far('match:recordOf helper', { checkMatches: ( specimen, @@ -1134,7 +1134,7 @@ const makePatternKit = () => { getRankCover: _entryPatt => getPassStyleCover('copyRecord'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchArrayOfHelper = Far('match:arrayOf helper', { checkMatches: (specimen, [subPatt, limits = undefined], check) => { const { arrayLengthLimit } = limit(limits); @@ -1161,7 +1161,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('copyArray'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchSetOfHelper = Far('match:setOf helper', { checkMatches: (specimen, [keyPatt, limits = undefined], check) => { const { numSetElementsLimit } = limit(limits); @@ -1188,7 +1188,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchBagOfHelper = Far('match:bagOf helper', { checkMatches: ( specimen, @@ -1229,7 +1229,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchMapOfHelper = Far('match:mapOf helper', { checkMatches: ( specimen, @@ -1273,13 +1273,13 @@ const makePatternKit = () => { }); /** - * @param {import('./internal-types.js').Passable[]} specimen - * @param {import('./internal-types.js').Pattern[]} requiredPatt - * @param {import('./internal-types.js').Pattern[]} optionalPatt + * @param {import('./types.js').Passable[]} specimen + * @param {import('./types.js').Pattern[]} requiredPatt + * @param {import('./types.js').Pattern[]} optionalPatt * @returns {{ - * requiredSpecimen: import('./internal-types.js').Passable[], - * optionalSpecimen: import('./internal-types.js').Passable[], - * restSpecimen: import('./internal-types.js').Passable[] + * requiredSpecimen: import('./types.js').Passable[], + * optionalSpecimen: import('./types.js').Passable[], + * restSpecimen: import('./types.js').Passable[] * }} */ const splitArrayParts = (specimen, requiredPatt, optionalPatt) => { @@ -1299,14 +1299,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {import('./internal-types.js').Pattern[]} optionalPatt + * @param {import('./types.js').Pattern[]} optionalPatt * @param {number} length - * @returns {import('./internal-types.js').Pattern[]} The partialPatt + * @returns {import('./types.js').Pattern[]} The partialPatt */ const adaptArrayPattern = (optionalPatt, length) => harden(optionalPatt.slice(0, length).map(patt => MM.opt(patt))); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchSplitArrayHelper = Far('match:splitArray helper', { checkMatches: ( specimen, @@ -1345,7 +1345,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1381,22 +1381,22 @@ const makePatternKit = () => { }); /** - * @param {import('./internal-types.js').CopyRecord} specimen - * @param {import('./internal-types.js').CopyRecord} requiredPatt - * @param {import('./internal-types.js').CopyRecord} optionalPatt + * @param {import('./types.js').CopyRecord} specimen + * @param {import('./types.js').CopyRecord} requiredPatt + * @param {import('./types.js').CopyRecord} optionalPatt * @returns {{ - * requiredSpecimen: import('./internal-types.js').CopyRecord, - * optionalSpecimen: import('./internal-types.js').CopyRecord, - * restSpecimen: import('./internal-types.js').CopyRecord + * requiredSpecimen: import('./types.js').CopyRecord, + * optionalSpecimen: import('./types.js').CopyRecord, + * restSpecimen: import('./types.js').CopyRecord * }} */ const splitRecordParts = (specimen, requiredPatt, optionalPatt) => { // Not frozen! Mutated in place - /** @type {[string, import('./internal-types.js').Passable][]} */ + /** @type {[string, import('./types.js').Passable][]} */ const requiredEntries = []; - /** @type {[string, import('./internal-types.js').Passable][]} */ + /** @type {[string, import('./types.js').Passable][]} */ const optionalEntries = []; - /** @type {[string, import('./internal-types.js').Passable][]} */ + /** @type {[string, import('./types.js').Passable][]} */ const restEntries = []; for (const [name, value] of entries(specimen)) { if (hasOwnPropertyOf(requiredPatt, name)) { @@ -1419,14 +1419,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {import('./internal-types.js').CopyRecord} optionalPatt + * @param {import('./types.js').CopyRecord} optionalPatt * @param {string[]} names - * @returns {import('./internal-types.js').CopyRecord} The partialPatt + * @returns {import('./types.js').CopyRecord} The partialPatt */ const adaptRecordPattern = (optionalPatt, names) => fromUniqueEntries(names.map(name => [name, MM.opt(optionalPatt[name])])); - /** @type {import('./internal-types.js').MatchHelper} */ + /** @type {import('./types.js').MatchHelper} */ const matchSplitRecordHelper = Far('match:splitRecord helper', { checkMatches: ( specimen, @@ -1457,7 +1457,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {import('./internal-types.js').Checker} check + * @param {import('./types.js').Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1492,7 +1492,7 @@ const makePatternKit = () => { ]) => getPassStyleCover(passStyleOf(requiredPatt)), }); - /** @type {Record} */ + /** @type {Record} */ const HelpersByMatchTag = harden({ 'match:any': matchAnyHelper, 'match:and': matchAndHelper, @@ -1557,7 +1557,7 @@ const makePatternKit = () => { * payloads array. * * @param {string} tag - * @param {import('./internal-types.js').Passable[]} payload + * @param {import('./types.js').Passable[]} payload */ const makeLimitsMatcher = (tag, payload) => { if (payload[payload.length - 1] === undefined) { @@ -1596,7 +1596,7 @@ const makePatternKit = () => { // ////////////////// - /** @type {import('./internal-types.js').MatcherNamespace} */ + /** @type {import('./types.js').MatcherNamespace} */ const M = harden({ any: () => AnyShape, and: (...patts) => makeMatcher('match:and', patts), @@ -1744,7 +1744,7 @@ const AwaitArgGuardShape = M.kind('guard:awaitArgGuard'); /** * @param {any} specimen - * @returns {specimen is import('./internal-types.js').AwaitArgGuard} + * @returns {specimen is import('./types.js').AwaitArgGuard} */ export const isAwaitArgGuard = specimen => matches(specimen, AwaitArgGuardShape); @@ -1752,7 +1752,7 @@ harden(isAwaitArgGuard); /** * @param {any} specimen - * @returns {asserts specimen is import('./internal-types.js').AwaitArgGuard} + * @returns {asserts specimen is import('./types.js').AwaitArgGuard} */ export const assertAwaitArgGuard = specimen => { mustMatch(specimen, AwaitArgGuardShape, 'awaitArgGuard'); @@ -1763,8 +1763,8 @@ harden(assertAwaitArgGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @param {import('./internal-types.js').AwaitArgGuard} awaitArgGuard - * @returns {import('./internal-types.js').AwaitArgGuardPayload} + * @param {import('./types.js').AwaitArgGuard} awaitArgGuard + * @returns {import('./types.js').AwaitArgGuardPayload} */ export const getAwaitArgGuardPayload = awaitArgGuard => { assertAwaitArgGuard(awaitArgGuard); @@ -1773,11 +1773,11 @@ export const getAwaitArgGuardPayload = awaitArgGuard => { harden(getAwaitArgGuardPayload); /** - * @param {import('./internal-types.js').Pattern} argPattern - * @returns {import('./internal-types.js').AwaitArgGuard} + * @param {import('./types.js').Pattern} argPattern + * @returns {import('./types.js').AwaitArgGuard} */ const makeAwaitArgGuard = argPattern => { - /** @type {import('./internal-types.js').AwaitArgGuard} */ + /** @type {import('./types.js').AwaitArgGuard} */ const result = makeTagged('guard:awaitArgGuard', { argGuard: argPattern, }); @@ -1797,7 +1797,7 @@ export const assertRawGuard = specimen => mustMatch(specimen, RawGuardShape, 'rawGuard'); /** - * @returns {import('./internal-types.js').RawGuard} + * @returns {import('./types.js').RawGuard} */ const makeRawGuard = () => makeTagged('guard:rawGuard', {}); @@ -1836,7 +1836,7 @@ const MethodGuardShape = M.kind('guard:methodGuard'); /** * @param {any} specimen - * @returns {asserts specimen is import('./internal-types.js').MethodGuard} + * @returns {asserts specimen is import('./types.js').MethodGuard} */ export const assertMethodGuard = specimen => { mustMatch(specimen, MethodGuardShape, 'methodGuard'); @@ -1847,8 +1847,8 @@ harden(assertMethodGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @param {import('./internal-types.js').MethodGuard} methodGuard - * @returns {import('./internal-types.js').MethodGuardPayload} + * @param {import('./types.js').MethodGuard} methodGuard + * @returns {import('./types.js').MethodGuardPayload} */ export const getMethodGuardPayload = methodGuard => { assertMethodGuard(methodGuard); @@ -1858,10 +1858,10 @@ harden(getMethodGuardPayload); /** * @param {'sync'|'async'} callKind - * @param {import('./internal-types.js').ArgGuard[]} argGuards - * @param {import('./internal-types.js').ArgGuard[]} [optionalArgGuards] - * @param {import('./internal-types.js').SyncValueGuard} [restArgGuard] - * @returns {import('./internal-types.js').MethodGuardMaker} + * @param {import('./types.js').ArgGuard[]} argGuards + * @param {import('./types.js').ArgGuard[]} [optionalArgGuards] + * @param {import('./types.js').SyncValueGuard} [restArgGuard] + * @returns {import('./types.js').MethodGuardMaker} */ const makeMethodGuardMaker = ( callKind, @@ -1887,7 +1887,7 @@ const makeMethodGuardMaker = ( ); }, returns: (returnGuard = M.undefined()) => { - /** @type {import('./internal-types.js').MethodGuard} */ + /** @type {import('./types.js').MethodGuard} */ const result = makeTagged('guard:methodGuard', { callKind, argGuards, @@ -1916,7 +1916,7 @@ const InterfaceGuardShape = M.kind('guard:interfaceGuard'); /** * @param {any} specimen - * @returns {asserts specimen is import('./internal-types.js').InterfaceGuard} + * @returns {asserts specimen is import('./types.js').InterfaceGuard} */ export const assertInterfaceGuard = specimen => { mustMatch(specimen, InterfaceGuardShape, 'interfaceGuard'); @@ -1927,9 +1927,9 @@ harden(assertInterfaceGuard); * By using this abstraction rather than accessing the properties directly, * we smooth the transition to https://github.com/endojs/endo/pull/1712 * - * @template {Record} [T=Record] - * @param {import('./internal-types.js').InterfaceGuard} interfaceGuard - * @returns {import('./internal-types.js').InterfaceGuardPayload} + * @template {Record} [T=Record] + * @param {import('./types.js').InterfaceGuard} interfaceGuard + * @returns {import('./types.js').InterfaceGuardPayload} */ export const getInterfaceGuardPayload = interfaceGuard => { assertInterfaceGuard(interfaceGuard); @@ -1940,7 +1940,7 @@ harden(getInterfaceGuardPayload); const emptyCopyMap = makeCopyMap([]); /** - * @param {import('./internal-types.js').InterfaceGuard} interfaceGuard + * @param {import('./types.js').InterfaceGuard} interfaceGuard * @returns {(string | symbol)[]} */ export const getInterfaceMethodKeys = interfaceGuard => { @@ -1957,11 +1957,11 @@ export const getInterfaceMethodKeys = interfaceGuard => { harden(getInterfaceMethodKeys); /** - * @template {Record} [M = Record] + * @template {Record} [M = Record] * @param {string} interfaceName * @param {M} methodGuards * @param {{ sloppy?: boolean, defaultGuards?: import('../types.js').DefaultGuardType }} [options] - * @returns {import('./internal-types.js').InterfaceGuard} + * @returns {import('./types.js').InterfaceGuard} */ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { const { sloppy = false, defaultGuards = sloppy ? 'passable' : undefined } = @@ -1969,9 +1969,9 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { // For backwards compatibility, string-keyed method guards are represented in // a CopyRecord. But symbol-keyed methods cannot be, so we put those in a // CopyMap when present. - /** @type {Record} */ + /** @type {Record} */ const stringMethodGuards = {}; - /** @type {Array<[symbol, import('./internal-types.js').MethodGuard]>} */ + /** @type {Array<[symbol, import('./types.js').MethodGuard]>} */ const symbolMethodGuardsEntries = []; for (const key of ownKeys(methodGuards)) { const value = methodGuards[/** @type {string} */ (key)]; @@ -1981,7 +1981,7 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { stringMethodGuards[key] = value; } } - /** @type {import('./internal-types.js').InterfaceGuard} */ + /** @type {import('./types.js').InterfaceGuard} */ const result = makeTagged('guard:interfaceGuard', { interfaceName, methodGuards: stringMethodGuards, @@ -1991,9 +1991,7 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { defaultGuards, }); assertInterfaceGuard(result); - return /** @type {import('./internal-types.js').InterfaceGuard} */ ( - result - ); + return /** @type {import('./types.js').InterfaceGuard} */ (result); }; const GuardPayloadShapes = harden({ diff --git a/packages/patterns/src/patterns/internal-types.js b/packages/patterns/src/patterns/types.js similarity index 100% rename from packages/patterns/src/patterns/internal-types.js rename to packages/patterns/src/patterns/types.js