diff --git a/packages/bundle-source/demo/comments/types.js b/packages/bundle-source/demo/comments/types.js index 858ff01edf..febf1775b1 100644 --- a/packages/bundle-source/demo/comments/types.js +++ b/packages/bundle-source/demo/comments/types.js @@ -1 +1 @@ -/** @typedef {import('./types.js').Bogus} Bogus */ +/** @import {Bogus} from './types.js' */ diff --git a/packages/captp/src/captp.js b/packages/captp/src/captp.js index db6033b0f8..fdf527a08e 100644 --- a/packages/captp/src/captp.js +++ b/packages/captp/src/captp.js @@ -1,8 +1,6 @@ /// -/** @template [R=unknown] @typedef {import('@endo/eventual-send').Settler} Settler */ -/** @template [R=unknown] @typedef {import('@endo/eventual-send').HandledExecutor} HandledExecutor */ -/** @template [R=unknown] @typedef {import('@endo/eventual-send').RemoteKit} RemoteKit */ +/** @import {RemoteKit, Settler} from '@endo/eventual-send' */ // Your app may need to `import '@endo/eventual-send/shim.js'` to get HandledPromise @@ -804,7 +802,7 @@ export const makeCapTP = ( serialize, unserialize, makeTrapHandler, - Trap: /** @type {import('./types.js').Trap | undefined} */ (undefined), + Trap: /** @type {import('./ts-types.js').Trap | undefined} */ (undefined), }; if (trapGuest) { diff --git a/packages/captp/src/loopback.js b/packages/captp/src/loopback.js index c29c5a3561..7726fba055 100644 --- a/packages/captp/src/loopback.js +++ b/packages/captp/src/loopback.js @@ -5,10 +5,7 @@ import { makeFinalizingMap } from './finalize.js'; export { E }; -/** - * @template T - * @typedef {import('@endo/eventual-send').ERef} ERef - */ +/** @import {ERef} from '@endo/eventual-send' */ /** * Create an async-isolated channel to an object. diff --git a/packages/captp/src/trap.js b/packages/captp/src/trap.js index db789935d6..5b7c81afda 100644 --- a/packages/captp/src/trap.js +++ b/packages/captp/src/trap.js @@ -58,7 +58,7 @@ const TrapProxyHandler = (x, trapImpl) => { /** * @param {import('./types.js').TrapImpl} trapImpl - * @returns {Trap} + * @returns {import('./ts-types.js').Trap} */ export const makeTrap = trapImpl => { const Trap = x => { diff --git a/packages/captp/src/types.js b/packages/captp/src/types.js index aa68b83103..ff22ce4e18 100644 --- a/packages/captp/src/types.js +++ b/packages/captp/src/types.js @@ -47,10 +47,3 @@ export {}; * @returns {AsyncIterator | undefined} If an AsyncIterator is * returned, it will satisfy a future guest IterationObserver. */ - -/** @typedef {import('./ts-types.js').Trap} Trap */ - -/** - * @template T - * @typedef {import('./ts-types').TrapHandler} TrapHandler - */ diff --git a/packages/compartment-mapper/src/import-archive.js b/packages/compartment-mapper/src/import-archive.js index 5eeffd8065..0b5644e7d2 100644 --- a/packages/compartment-mapper/src/import-archive.js +++ b/packages/compartment-mapper/src/import-archive.js @@ -15,6 +15,9 @@ import { assertCompartmentMap } from './compartment-map.js'; import { exitModuleImportHookMaker } from './import-hook.js'; import { attenuateModuleHook, enforceModulePolicy } from './policy.js'; +/** @import {StaticModuleType} from 'ses' */ +/** @import {Application, CompartmentDescriptor, ComputeSourceLocationHook, ComputeSourceMapLocationHook, ExecuteFn, ExecuteOptions, ExitModuleImportHook, HashFn, ImportHookMaker, LoadArchiveOptions, ParserImplementation, ReadPowers} from './types.js' */ + const DefaultCompartment = Compartment; const { Fail, quote: q } = assert; @@ -23,7 +26,7 @@ const textDecoder = new TextDecoder(); const { freeze } = Object; -/** @type {Record} */ +/** @type {Record} */ const parserForLanguage = { 'pre-cjs-json': parserPreCjs, 'pre-mjs-json': parserPreMjs, @@ -34,7 +37,7 @@ const parserForLanguage = { /** * @param {string} errorMessage - error to throw on execute - * @returns {import('./types.js').StaticModuleType} + * @returns {StaticModuleType} */ const postponeErrorToExecute = errorMessage => { // Return a place-holder that'd throw an error if executed @@ -55,13 +58,13 @@ const postponeErrorToExecute = errorMessage => { /** * @param {(path: string) => Uint8Array} get - * @param {Record} compartments + * @param {Record} compartments * @param {string} archiveLocation - * @param {import('./types.js').HashFn} [computeSha512] - * @param {import('./types.js').ComputeSourceLocationHook} [computeSourceLocation] - * @param {import('./types.js').ExitModuleImportHook} [exitModuleImportHook] - * @param {import('./types.js').ComputeSourceMapLocationHook} [computeSourceMapLocation] - * @returns {import('./types.js').ImportHookMaker} + * @param {HashFn} [computeSha512] + * @param {ComputeSourceLocationHook} [computeSourceLocation] + * @param {ExitModuleImportHook} [exitModuleImportHook] + * @param {ComputeSourceMapLocationHook} [computeSourceMapLocation] + * @returns {ImportHookMaker} */ const makeArchiveImportHookMaker = ( get, @@ -73,7 +76,7 @@ const makeArchiveImportHookMaker = ( computeSourceMapLocation = undefined, ) => { // per-assembly: - /** @type {import('./types.js').ImportHookMaker} */ + /** @type {ImportHookMaker} */ const makeImportHook = ({ packageLocation, packageName, @@ -244,13 +247,13 @@ const makeFauxModuleExportsNamespace = Compartment => { * @param {string} [archiveLocation] * @param {object} [options] * @param {string} [options.expectedSha512] - * @param {import('./types.js').HashFn} [options.computeSha512] + * @param {HashFn} [options.computeSha512] * @param {Record} [options.modules] - * @param {import('./types.js').ExitModuleImportHook} [options.importHook] + * @param {ExitModuleImportHook} [options.importHook] * @param {CompartmentConstructor} [options.Compartment] - * @param {import('./types.js').ComputeSourceLocationHook} [options.computeSourceLocation] - * @param {import('./types.js').ComputeSourceMapLocationHook} [options.computeSourceMapLocation] - * @returns {Promise} + * @param {ComputeSourceLocationHook} [options.computeSourceLocation] + * @param {ComputeSourceMapLocationHook} [options.computeSourceMapLocation] + * @returns {Promise} */ export const parseArchive = async ( archiveBytes, @@ -356,7 +359,7 @@ export const parseArchive = async ( )}`; } - /** @type {import('./types.js').ExecuteFn} */ + /** @type {ExecuteFn} */ const execute = async options => { const { globals, @@ -400,10 +403,10 @@ export const parseArchive = async ( }; /** - * @param {import('./types.js').ReadFn | import('./types.js').ReadPowers} readPowers + * @param {import('@endo/zip').ReadFn | ReadPowers} readPowers * @param {string} archiveLocation - * @param {import('./types.js').LoadArchiveOptions} [options] - * @returns {Promise} + * @param {LoadArchiveOptions} [options] + * @returns {Promise} */ export const loadArchive = async ( readPowers, @@ -428,9 +431,9 @@ export const loadArchive = async ( }; /** - * @param {import('./types.js').ReadFn | import('./types.js').ReadPowers} readPowers + * @param {import('@endo/zip').ReadFn | ReadPowers} readPowers * @param {string} archiveLocation - * @param {import('./types.js').ExecuteOptions & import('./types.js').LoadArchiveOptions} options + * @param {ExecuteOptions & LoadArchiveOptions} options * @returns {Promise} */ export const importArchive = async (readPowers, archiveLocation, options) => { diff --git a/packages/compartment-mapper/src/link.js b/packages/compartment-mapper/src/link.js index 873845b55d..6962d3e8ad 100644 --- a/packages/compartment-mapper/src/link.js +++ b/packages/compartment-mapper/src/link.js @@ -10,9 +10,8 @@ /** @import {ModuleDescriptor} from './types.js' */ /** @import {CompartmentDescriptor} from './types.js' */ /** @import {CompartmentMapDescriptor} from './types.js' */ -/** @import {DeferredAttenuatorsProvider} from './types.js' */ /** @import {LinkOptions} from './types.js' */ -/** @template T @typedef {import('@endo/eventual-send').ERef} ERef */ +/** @import {ERef} from '@endo/eventual-send' */ import { resolve as resolveFallback } from './node-module-specifier.js'; import { parseExtension } from './extension.js'; diff --git a/packages/compartment-mapper/src/types.js b/packages/compartment-mapper/src/types.js index 9e8f60504c..571bea1559 100644 --- a/packages/compartment-mapper/src/types.js +++ b/packages/compartment-mapper/src/types.js @@ -3,11 +3,11 @@ export {}; -/** @typedef {import('ses').FinalStaticModuleType} FinalStaticModuleType */ -/** @typedef {import('ses').ThirdPartyStaticModuleInterface} ThirdPartyStaticModuleInterface */ -/** @typedef {import('ses').ImportHook} ImportHook */ -/** @typedef {import('ses').StaticModuleType} StaticModuleType */ -/** @typedef {import('ses').Transform} Transform */ +/** @import {FinalStaticModuleType} from 'ses' */ +/** @import {ThirdPartyStaticModuleInterface} from 'ses' */ +/** @import {ImportHook} from 'ses' */ +/** @import {StaticModuleType} from 'ses' */ +/** @import {Transform} from 'ses' */ // ///////////////////////////////////////////////////////////////////////////// diff --git a/packages/far/src/index.js b/packages/far/src/index.js index dc034c62c1..58decf5966 100644 --- a/packages/far/src/index.js +++ b/packages/far/src/index.js @@ -1,6 +1,7 @@ export { E } from '@endo/eventual-send'; export { Far, getInterfaceOf, passStyleOf } from '@endo/pass-style'; +// TODO re-export from eventual-send, may require .d.ts /** * @template Primary * @template [Local=import('@endo/eventual-send').DataOnly] diff --git a/packages/marshal/src/deeplyFulfilled.js b/packages/marshal/src/deeplyFulfilled.js index 98ac2989be..3cdbf07f8e 100644 --- a/packages/marshal/src/deeplyFulfilled.js +++ b/packages/marshal/src/deeplyFulfilled.js @@ -5,7 +5,6 @@ import { isPromise } from '@endo/promise-kit'; import { getTag, isObject, makeTagged, passStyleOf } from '@endo/pass-style'; /** @import {Passable} from '@endo/pass-style' */ -/** @template T @typedef {import('@endo/eventual-send').ERef} ERef */ import { X, q } from '@endo/errors'; diff --git a/packages/marshal/src/encodeToSmallcaps.js b/packages/marshal/src/encodeToSmallcaps.js index 03dc982eb7..36f10ac522 100644 --- a/packages/marshal/src/encodeToSmallcaps.js +++ b/packages/marshal/src/encodeToSmallcaps.js @@ -18,10 +18,8 @@ import { } from '@endo/pass-style'; import { X, Fail, q } from '@endo/errors'; -/** @import {Passable} from '@endo/pass-style' */ -/** @import {Remotable} from '@endo/pass-style' */ -// @typedef {import('./types.js').SmallcapsEncoding} SmallcapsEncoding */ -// @typedef {import('./types.js').SmallcapsEncodingUnion} SmallcapsEncodingUnion */ +/** @import {Passable, Remotable} from '@endo/pass-style' */ +// FIXME define actual types /** @typedef {any} SmallcapsEncoding */ /** @typedef {any} SmallcapsEncodingUnion */ diff --git a/packages/marshal/src/marshal-justin.js b/packages/marshal/src/marshal-justin.js index 62ce03a445..681c14e962 100644 --- a/packages/marshal/src/marshal-justin.js +++ b/packages/marshal/src/marshal-justin.js @@ -10,7 +10,6 @@ import { q, X, Fail } from '@endo/errors'; import { QCLASS } from './encodeToCapData.js'; /** @import {Encoding} from './types.js' */ -/** @template T @typedef {import('./types.js').CapData} CapData */ const { ownKeys } = Reflect; const { isArray } = Array; diff --git a/packages/marshal/src/marshal.js b/packages/marshal/src/marshal.js index ed9065657b..a2bf0f835b 100644 --- a/packages/marshal/src/marshal.js +++ b/packages/marshal/src/marshal.js @@ -21,11 +21,7 @@ import { makeEncodeToSmallcaps, } from './encodeToSmallcaps.js'; -/** @import {MakeMarshalOptions} from './types.js' */ -/** @template Slot @typedef {import('./types.js').ConvertSlotToVal} ConvertSlotToVal */ -/** @template Slot @typedef {import('./types.js').ConvertValToSlot} ConvertValToSlot */ -/** @template Slot @typedef {import('./types.js').ToCapData} ToCapData */ -/** @template Slot @typedef {import('./types.js').FromCapData} FromCapData */ +/** @import {ConvertSlotToVal, ConvertValToSlot, FromCapData, MakeMarshalOptions, ToCapData} from './types.js' */ /** @import {Passable} from '@endo/pass-style' */ /** @import {InterfaceSpec} from '@endo/pass-style' */ /** @import {Encoding} from './types.js' */ diff --git a/packages/pass-style/src/error.js b/packages/pass-style/src/error.js index 0624078ce4..89aa72c0a6 100644 --- a/packages/pass-style/src/error.js +++ b/packages/pass-style/src/error.js @@ -4,7 +4,7 @@ import { X, q } from '@endo/errors'; import { assertChecker } from './passStyle-helpers.js'; /** @import {PassStyleHelper} from './internal-types.js' */ -/** @import {Checker} from './types.js' */ +/** @import {Checker, PassStyleOf} from './types.js' */ const { getPrototypeOf, getOwnPropertyDescriptors, hasOwn, entries } = Object; @@ -88,7 +88,7 @@ harden(isErrorLike); /** * @param {string} propName * @param {PropertyDescriptor} desc - * @param {import('./internal-types.js').PassStyleOf} passStyleOfRecur + * @param {PassStyleOf} passStyleOfRecur * @param {Checker} [check] * @returns {boolean} */ @@ -157,7 +157,7 @@ harden(checkRecursivelyPassableErrorPropertyDesc); /** * @param {unknown} candidate - * @param {import('./internal-types.js').PassStyleOf} passStyleOfRecur + * @param {PassStyleOf} passStyleOfRecur * @param {Checker} [check] * @returns {boolean} */ diff --git a/packages/pass-style/src/internal-types.js b/packages/pass-style/src/internal-types.js index 857dba8082..68d8c01435 100644 --- a/packages/pass-style/src/internal-types.js +++ b/packages/pass-style/src/internal-types.js @@ -1,8 +1,8 @@ export {}; -/** @typedef {import('./types.js').Checker} Checker */ -/** @typedef {import('./types.js').PassStyle} PassStyle */ -/** @typedef {import('./types.js').PassStyleOf} PassStyleOf */ +/** @import {Checker} from './types.js' */ +/** @import {PassStyle} from './types.js' */ +/** @import {PassStyleOf} from './types.js' */ /** * The PassStyleHelper are only used to make a `passStyleOf` function. diff --git a/packages/pass-style/src/make-far.js b/packages/pass-style/src/make-far.js index 1f3155027d..072ccd8273 100644 --- a/packages/pass-style/src/make-far.js +++ b/packages/pass-style/src/make-far.js @@ -5,8 +5,8 @@ import { q, Fail } from '@endo/errors'; import { assertChecker, PASS_STYLE } from './passStyle-helpers.js'; import { assertIface, getInterfaceOf, RemotableHelper } from './remotable.js'; +/** @import {RemotableBrand} from '@endo/eventual-send' */ /** @import {InterfaceSpec} from './types.js' */ -/** @template L,R @typedef {import('@endo/eventual-send').RemotableBrand} RemotableBrand */ const { prototype: functionPrototype } = Function; const { diff --git a/packages/pass-style/src/typeGuards.js b/packages/pass-style/src/typeGuards.js index ca346150e0..344f36bea2 100644 --- a/packages/pass-style/src/typeGuards.js +++ b/packages/pass-style/src/typeGuards.js @@ -1,16 +1,7 @@ import { Fail, q } from '@endo/errors'; import { passStyleOf } from './passStyleOf.js'; -/** @import {Passable} from './types.js' */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('./types.js').CopyArray} CopyArray - */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('./types.js').CopyRecord} CopyRecord - */ -/** @import {RemotableObject} from './types.js' */ +/** @import {CopyArray, CopyRecord, Passable, RemotableObject} from './types.js' */ /** * Check whether the argument is a pass-by-copy array, AKA a "copyArray" diff --git a/packages/patterns/src/keys/checkKey.js b/packages/patterns/src/keys/checkKey.js index 084bcc6277..04383756b2 100644 --- a/packages/patterns/src/keys/checkKey.js +++ b/packages/patterns/src/keys/checkKey.js @@ -22,13 +22,7 @@ const { ownKeys } = Reflect; /** @import {Checker} from '@endo/marshal' */ /** @import {Passable} from '@endo/pass-style' */ -/** @import {KeyComparison} from '../types' */ -/** @import {Key} from '../types' */ -/** @template {Key} [K=Key] @typedef {import('../types').CopyBag} CopyBag */ -/** @template {Key} [K=Key] @typedef {import('../types').CopySet} CopySet */ -/** @template {Key} [K=Key] @template {Passable} [V=Passable] @typedef {import('../types').CopyMap} CopyMap */ -/** @import {KeyCompare} from '../types' */ -/** @import {FullCompare} from '../types' */ +/** @import {CopyBag, CopyMap, CopySet, Key} from '../types' */ // ////////////////// Primitive and Scalar keys //////////////////////////////// diff --git a/packages/patterns/src/keys/compareKeys.js b/packages/patterns/src/keys/compareKeys.js index 19a679c3cb..9743f6d834 100644 --- a/packages/patterns/src/keys/compareKeys.js +++ b/packages/patterns/src/keys/compareKeys.js @@ -17,7 +17,7 @@ import { } from './checkKey.js'; import { makeCompareCollection } from './keycollection-operators.js'; -/** @template {import('../types.js').Key} [K=import('../types.js').Key] @typedef {import('../types').CopySet} CopySet */ +/** @import {CopySet} from '../types' */ /** * CopySet X is smaller than CopySet Y iff all of these conditions hold: diff --git a/packages/patterns/src/keys/copyBag.js b/packages/patterns/src/keys/copyBag.js index 65af6a4685..2d0baff4f1 100644 --- a/packages/patterns/src/keys/copyBag.js +++ b/packages/patterns/src/keys/copyBag.js @@ -12,8 +12,7 @@ import { import { X } from '@endo/errors'; -/** @template {Key} [K=Key] @typedef {import('../types').CopyBag} CopyBag */ -/** @import {Key} from '../types' */ +/** @import {CopyBag} from '../types' */ /** @import {FullCompare} from '../types' */ /** @import {Checker} from '@endo/marshal' */ /** @import {Passable} from '@endo/pass-style' */ diff --git a/packages/patterns/src/patterns/getGuardPayloads.js b/packages/patterns/src/patterns/getGuardPayloads.js index 9b3d681b90..02e1842465 100644 --- a/packages/patterns/src/patterns/getGuardPayloads.js +++ b/packages/patterns/src/patterns/getGuardPayloads.js @@ -16,6 +16,8 @@ import { } from './patternMatchers.js'; import { getCopyMapKeys, makeCopyMap } from '../keys/checkKey.js'; +/** @import {AwaitArgGuard, AwaitArgGuardPayload, InterfaceGuard, InterfaceGuardPayload, MethodGuard, MethodGuardPayload} from '../types.js' */ + // The get*GuardPayload functions exist to adapt to the worlds both // before and after https://github.com/endojs/endo/pull/1712 . When // given something that would be the expected guard in either world, @@ -58,8 +60,8 @@ const LegacyAwaitArgGuardShape = harden({ * an argument that matches that pattern, i.e., a copyRecord argument that * at least contains a `klass: 'awaitArgGuard'` property. * - * @param {import('./types.js').AwaitArgGuard} awaitArgGuard - * @returns {import('./types.js').AwaitArgGuardPayload} + * @param {AwaitArgGuard} awaitArgGuard + * @returns {AwaitArgGuardPayload} */ export const getAwaitArgGuardPayload = awaitArgGuard => { if (matches(awaitArgGuard, LegacyAwaitArgGuardShape)) { @@ -142,8 +144,8 @@ const adaptLegacyArgGuard = argGuard => * currently any context where either a methodGuard or a copyRecord would * both be meaningful. * - * @param {import('./types.js').MethodGuard} methodGuard - * @returns {import('./types.js').MethodGuardPayload} + * @param {MethodGuard} methodGuard + * @returns {MethodGuardPayload} */ export const getMethodGuardPayload = methodGuard => { if (matches(methodGuard, MethodGuardShape)) { @@ -234,9 +236,9 @@ const adaptMethodGuard = methodGuard => { * currently any context where either an interfaceGuard or a copyRecord would * both be meaningful. * - * @template {Record} [T=Record] - * @param {import('./types.js').InterfaceGuard} interfaceGuard - * @returns {import('./types.js').InterfaceGuardPayload} + * @template {Record} [T=Record] + * @param {InterfaceGuard} interfaceGuard + * @returns {InterfaceGuardPayload} */ export const getInterfaceGuardPayload = interfaceGuard => { if (matches(interfaceGuard, InterfaceGuardShape)) { @@ -264,7 +266,7 @@ harden(getInterfaceGuardPayload); const emptyCopyMap = makeCopyMap([]); /** - * @param {import('./types.js').InterfaceGuard} interfaceGuard + * @param {InterfaceGuard} interfaceGuard * @returns {(string | symbol)[]} */ export const getInterfaceMethodKeys = interfaceGuard => { diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index 7f3f1271a0..6a043fa800 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -36,10 +36,14 @@ import { generateCollectionPairEntries } from '../keys/keycollection-operators.j /// +/** @import {Checker, CopyRecord, CopyTagged, Passable} from '@endo/pass-style' */ +/** @import {ArgGuard, AwaitArgGuard, CheckPattern, GetRankCover, InterfaceGuard, MatcherNamespace, MethodGuard, MethodGuardMaker, Pattern, RawGuard, SyncValueGuard} from '../types.js' */ +/** @import {Kind, MatchHelper} from './types.js' */ + const { entries, values } = Object; const { ownKeys } = Reflect; -/** @type {WeakSet} */ +/** @type {WeakSet} */ const patternMemo = new WeakSet(); // /////////////////////// Match Helpers Helpers ///////////////////////////// @@ -74,11 +78,11 @@ export const defaultLimits = harden({ * Thus, the result only needs to support destructuring. The current * implementation uses inheritance as a cheap hack. * - * @param {import('./types.js').Limits} [limits] - * @returns {import('./types.js').AllLimits} + * @param {import('../types.js').Limits} [limits] + * @returns {import('../types.js').AllLimits} */ const limit = (limits = {}) => - /** @type {import('./types.js').AllLimits} */ ( + /** @type {import('../types.js').AllLimits} */ ( harden({ __proto__: defaultLimits, ...limits }) ); @@ -129,7 +133,7 @@ const checkIsWellFormedWithLimit = ( /** * @param {unknown} specimen * @param {number} decimalDigitsLimit - * @param {import('./types.js').Checker} check + * @param {Checker} check */ const checkDecimalDigitsLimit = (specimen, decimalDigitsLimit, check) => { if ( @@ -165,20 +169,20 @@ const makePatternKit = () => { * to register a payload shape with that meaning, use `MM.undefined()`. * * @param {string} tag - * @returns {import('./types.js').Pattern | undefined} + * @returns {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. */ @@ -188,9 +192,9 @@ const makePatternKit = () => { * Checks only recognized tags, and only if the tagged * passes the invariants associated with that recognition. * - * @param {import('./types.js').Passable} tagged - * @param {import('./types.js').Kind} tag - * @param {import('./types.js').Checker} check + * @param {Passable} tagged + * @param {Kind} tag + * @param {Checker} check * @returns {boolean} */ const checkTagged = (tagged, tag, check) => { @@ -230,9 +234,9 @@ const makePatternKit = () => { * invariants associated with that recognition. * Otherwise, `check(false, ...)` and returns undefined * - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Checker} [check] - * @returns {import('./types.js').Kind | undefined} + * @param {Passable} specimen + * @param {Checker} [check] + * @returns {Kind | undefined} */ const kindOf = (specimen, check = identChecker) => { const passStyle = passStyleOf(specimen); @@ -261,9 +265,9 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Kind} kind - * @param {import('./types.js').Checker} check + * @param {Passable} specimen + * @param {Kind} kind + * @param {Checker} check * @returns {boolean} */ const checkKind = (specimen, kind, check) => { @@ -289,16 +293,16 @@ const makePatternKit = () => { * Checks only recognized kinds, and only if the specimen * passes the invariants associated with that recognition. * - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Kind} kind + * @param {Passable} specimen + * @param {Kind} kind * @returns {boolean} */ const isKind = (specimen, kind) => checkKind(specimen, kind, identChecker); /** - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Key} keyAsPattern - * @param {import('./types.js').Checker} check + * @param {Passable} specimen + * @param {import('../types.js').Key} keyAsPattern + * @param {Checker} check * @returns {boolean} */ const checkAsKeyPatt = (specimen, keyAsPattern, check) => { @@ -315,7 +319,7 @@ const makePatternKit = () => { // /////////////////////// isPattern ///////////////////////////////////////// - /** @type {import('./types.js').CheckPattern} */ + /** @type {CheckPattern} */ const checkPattern = (patt, check) => { if (isKey(patt)) { // All keys are patterns. For these, the keyMemo will do. @@ -336,9 +340,9 @@ const makePatternKit = () => { }; /** - * @param {import('./types.js').Passable} patt - known not to be a key, and therefore known + * @param {Passable} patt - known not to be a key, and therefore known * not to be primitive. - * @param {import('./types.js').Checker} check + * @param {Checker} check * @returns {boolean} */ const checkPatternInternal = (patt, check) => { @@ -385,13 +389,13 @@ const makePatternKit = () => { }; /** - * @param {import('./types.js').Passable} patt + * @param {Passable} patt * @returns {boolean} */ const isPattern = patt => checkPattern(patt, identChecker); /** - * @param {import('./types.js').Pattern} patt + * @param {Pattern} patt */ const assertPattern = patt => { checkPattern(patt, assertChecker); @@ -400,9 +404,9 @@ const makePatternKit = () => { // /////////////////////// matches /////////////////////////////////////////// /** - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Pattern} pattern - * @param {import('./types.js').Checker} check + * @param {Passable} specimen + * @param {Pattern} pattern + * @param {Checker} check * @param {string|number} [label] * @returns {boolean} */ @@ -411,9 +415,9 @@ const makePatternKit = () => { applyLabelingError(checkMatchesInternal, [specimen, pattern, check], label); /** - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Pattern} patt - * @param {import('./types.js').Checker} check + * @param {Passable} specimen + * @param {Pattern} patt + * @param {Checker} check * @returns {boolean} */ const checkMatchesInternal = (specimen, patt, check) => { @@ -559,8 +563,8 @@ const makePatternKit = () => { }; /** - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Pattern} patt + * @param {Passable} specimen + * @param {Pattern} patt * @returns {boolean} */ const matches = (specimen, patt) => @@ -570,8 +574,8 @@ const makePatternKit = () => { * Returning normally indicates success. Match failure is indicated by * throwing. * - * @param {import('./types.js').Passable} specimen - * @param {import('./types.js').Pattern} patt + * @param {Passable} specimen + * @param {Pattern} patt * @param {string|number} [label] */ const mustMatch = (specimen, patt, label = undefined) => { @@ -596,7 +600,7 @@ const makePatternKit = () => { // /////////////////////// getRankCover ////////////////////////////////////// - /** @type {import('./types.js').GetRankCover} */ + /** @type {GetRankCover} */ const getRankCover = (patt, encodePassable) => { if (isKey(patt)) { const encoded = encodePassable(patt); @@ -707,9 +711,9 @@ const makePatternKit = () => { }; /** - * @param {import('./types.js').Passable[]} array - * @param {import('./types.js').Pattern} patt - * @param {import('./types.js').Checker} check + * @param {Passable[]} array + * @param {Pattern} patt + * @param {Checker} check * @param {string} [labelPrefix] * @returns {boolean} */ @@ -725,7 +729,7 @@ const makePatternKit = () => { // /////////////////////// Match Helpers ///////////////////////////////////// - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchAnyHelper = Far('match:any helper', { checkMatches: (_specimen, _matcherPayload, _check) => true, @@ -736,7 +740,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['', '{'], }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchAndHelper = Far('match:and helper', { checkMatches: (specimen, patts, check) => { return patts.every(patt => checkMatches(specimen, patt, check)); @@ -758,7 +762,7 @@ const makePatternKit = () => { ), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchOrHelper = Far('match:or helper', { checkMatches: (specimen, patts, check) => { const { length } = patts; @@ -793,7 +797,7 @@ const makePatternKit = () => { ), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchNotHelper = Far('match:not helper', { checkMatches: (specimen, patt, check) => { if (matches(specimen, patt)) { @@ -811,7 +815,7 @@ const makePatternKit = () => { getRankCover: (_patt, _encodePassable) => ['', '{'], }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchScalarHelper = Far('match:scalar helper', { checkMatches: (specimen, _matcherPayload, check) => checkScalarKey(specimen, check), @@ -821,7 +825,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchKeyHelper = Far('match:key helper', { checkMatches: (specimen, _matcherPayload, check) => checkKey(specimen, check), @@ -831,7 +835,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchPatternHelper = Far('match:pattern helper', { checkMatches: (specimen, _matcherPayload, check) => checkPattern(specimen, check), @@ -841,7 +845,7 @@ const makePatternKit = () => { getRankCover: (_matchPayload, _encodePassable) => ['a', 'z~'], }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchKindHelper = Far('match:kind helper', { checkMatches: checkKind, @@ -869,7 +873,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchTaggedHelper = Far('match:tagged helper', { checkMatches: (specimen, [tagPatt, payloadPatt], check) => { if (passStyleOf(specimen) !== 'tagged') { @@ -897,7 +901,7 @@ const makePatternKit = () => { getRankCover: (_kind, _encodePassable) => getPassStyleCover('tagged'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchBigintHelper = Far('match:bigint helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -919,7 +923,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchNatHelper = Far('match:nat helper', { checkMatches: (specimen, [limits = undefined], check) => { const { decimalDigitsLimit } = limit(limits); @@ -946,7 +950,7 @@ const makePatternKit = () => { getPassStyleCover('bigint'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchStringHelper = Far('match:string helper', { checkMatches: (specimen, [limits = undefined], check) => { const { stringLengthLimit } = limit(limits); @@ -974,7 +978,7 @@ const makePatternKit = () => { getPassStyleCover('string'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchSymbolHelper = Far('match:symbol helper', { checkMatches: (specimen, [limits = undefined], check) => { const { symbolNameLengthLimit } = limit(limits); @@ -1006,7 +1010,7 @@ const makePatternKit = () => { getPassStyleCover('symbol'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchRemotableHelper = Far('match:remotable helper', { checkMatches: (specimen, remotableDesc, check) => { if (isKind(specimen, 'remotable')) { @@ -1044,7 +1048,7 @@ const makePatternKit = () => { getPassStyleCover('remotable'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchLTEHelper = Far('match:lte helper', { checkMatches: (specimen, rightOperand, check) => keyLTE(specimen, rightOperand) || @@ -1066,7 +1070,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchLTHelper = Far('match:lt helper', { checkMatches: (specimen, rightOperand, check) => keyLT(specimen, rightOperand) || @@ -1077,7 +1081,7 @@ const makePatternKit = () => { getRankCover: matchLTEHelper.getRankCover, }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchGTEHelper = Far('match:gte helper', { checkMatches: (specimen, rightOperand, check) => keyGTE(specimen, rightOperand) || @@ -1099,7 +1103,7 @@ const makePatternKit = () => { }, }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchGTHelper = Far('match:gt helper', { checkMatches: (specimen, rightOperand, check) => keyGT(specimen, rightOperand) || @@ -1110,7 +1114,7 @@ const makePatternKit = () => { getRankCover: matchGTEHelper.getRankCover, }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchRecordOfHelper = Far('match:recordOf helper', { checkMatches: ( specimen, @@ -1159,7 +1163,7 @@ const makePatternKit = () => { getRankCover: _entryPatt => getPassStyleCover('copyRecord'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchArrayOfHelper = Far('match:arrayOf helper', { checkMatches: (specimen, [subPatt, limits = undefined], check) => { const { arrayLengthLimit } = limit(limits); @@ -1186,7 +1190,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('copyArray'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchSetOfHelper = Far('match:setOf helper', { checkMatches: (specimen, [keyPatt, limits = undefined], check) => { const { numSetElementsLimit } = limit(limits); @@ -1213,7 +1217,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchBagOfHelper = Far('match:bagOf helper', { checkMatches: ( specimen, @@ -1254,7 +1258,7 @@ const makePatternKit = () => { getRankCover: () => getPassStyleCover('tagged'), }); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchMapOfHelper = Far('match:mapOf helper', { checkMatches: ( specimen, @@ -1298,13 +1302,13 @@ const makePatternKit = () => { }); /** - * @param {import('./types.js').Passable[]} specimen - * @param {import('./types.js').Pattern[]} requiredPatt - * @param {import('./types.js').Pattern[]} optionalPatt + * @param {Passable[]} specimen + * @param {Pattern[]} requiredPatt + * @param {Pattern[]} optionalPatt * @returns {{ - * requiredSpecimen: import('./types.js').Passable[], - * optionalSpecimen: import('./types.js').Passable[], - * restSpecimen: import('./types.js').Passable[] + * requiredSpecimen: Passable[], + * optionalSpecimen: Passable[], + * restSpecimen: Passable[] * }} */ const splitArrayParts = (specimen, requiredPatt, optionalPatt) => { @@ -1324,14 +1328,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {import('./types.js').Pattern[]} optionalPatt + * @param {Pattern[]} optionalPatt * @param {number} length - * @returns {import('./types.js').Pattern[]} The partialPatt + * @returns {Pattern[]} The partialPatt */ const adaptArrayPattern = (optionalPatt, length) => harden(optionalPatt.slice(0, length).map(patt => MM.opt(patt))); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchSplitArrayHelper = Far('match:splitArray helper', { checkMatches: ( specimen, @@ -1370,7 +1374,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {import('./types.js').Checker} check + * @param {Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1406,22 +1410,22 @@ const makePatternKit = () => { }); /** - * @param {import('./types.js').CopyRecord} specimen - * @param {import('./types.js').CopyRecord} requiredPatt - * @param {import('./types.js').CopyRecord} optionalPatt + * @param {CopyRecord} specimen + * @param {CopyRecord} requiredPatt + * @param {CopyRecord} optionalPatt * @returns {{ - * requiredSpecimen: import('./types.js').CopyRecord, - * optionalSpecimen: import('./types.js').CopyRecord, - * restSpecimen: import('./types.js').CopyRecord + * requiredSpecimen: CopyRecord, + * optionalSpecimen: CopyRecord, + * restSpecimen: CopyRecord * }} */ const splitRecordParts = (specimen, requiredPatt, optionalPatt) => { // Not frozen! Mutated in place - /** @type {[string, import('./types.js').Passable][]} */ + /** @type {[string, Passable][]} */ const requiredEntries = []; - /** @type {[string, import('./types.js').Passable][]} */ + /** @type {[string, Passable][]} */ const optionalEntries = []; - /** @type {[string, import('./types.js').Passable][]} */ + /** @type {[string, Passable][]} */ const restEntries = []; for (const [name, value] of entries(specimen)) { if (hasOwnPropertyOf(requiredPatt, name)) { @@ -1444,14 +1448,14 @@ const makePatternKit = () => { * We encode this with the `M.or` pattern so it also produces a good * compression distinguishing `undefined` from absence. * - * @param {import('./types.js').CopyRecord} optionalPatt + * @param {CopyRecord} optionalPatt * @param {string[]} names - * @returns {import('./types.js').CopyRecord} The partialPatt + * @returns {CopyRecord} The partialPatt */ const adaptRecordPattern = (optionalPatt, names) => fromUniqueEntries(names.map(name => [name, MM.opt(optionalPatt[name])])); - /** @type {import('./types.js').MatchHelper} */ + /** @type {MatchHelper} */ const matchSplitRecordHelper = Far('match:splitRecord helper', { checkMatches: ( specimen, @@ -1482,7 +1486,7 @@ const makePatternKit = () => { /** * @param {Array} splitArray - * @param {import('./types.js').Checker} check + * @param {Checker} check */ checkIsWellFormed: (splitArray, check) => { if ( @@ -1517,7 +1521,7 @@ const makePatternKit = () => { ]) => getPassStyleCover(passStyleOf(requiredPatt)), }); - /** @type {Record} */ + /** @type {Record} */ const HelpersByMatchTag = harden({ 'match:any': matchAnyHelper, 'match:and': matchAndHelper, @@ -1583,7 +1587,7 @@ const makePatternKit = () => { * payloads array. * * @param {string} tag - * @param {import('./types.js').Passable[]} payload + * @param {Passable[]} payload */ const makeLimitsMatcher = (tag, payload) => { if (payload[payload.length - 1] === undefined) { @@ -1622,7 +1626,7 @@ const makePatternKit = () => { // ////////////////// - /** @type {import('./types.js').MatcherNamespace} */ + /** @type {MatcherNamespace} */ const M = harden({ any: () => AnyShape, and: (...patts) => makeMatcher('match:and', patts), @@ -1772,7 +1776,7 @@ export const AwaitArgGuardShape = M.kind('guard:awaitArgGuard'); /** * @param {any} specimen - * @returns {specimen is import('./types.js').AwaitArgGuard} + * @returns {specimen is AwaitArgGuard} */ export const isAwaitArgGuard = specimen => matches(specimen, AwaitArgGuardShape); @@ -1780,7 +1784,7 @@ harden(isAwaitArgGuard); /** * @param {any} specimen - * @returns {asserts specimen is import('./types.js').AwaitArgGuard} + * @returns {asserts specimen is AwaitArgGuard} */ export const assertAwaitArgGuard = specimen => { mustMatch(specimen, AwaitArgGuardShape, 'awaitArgGuard'); @@ -1788,11 +1792,11 @@ export const assertAwaitArgGuard = specimen => { harden(assertAwaitArgGuard); /** - * @param {import('./types.js').Pattern} argPattern - * @returns {import('./types.js').AwaitArgGuard} + * @param {Pattern} argPattern + * @returns {AwaitArgGuard} */ const makeAwaitArgGuard = argPattern => { - /** @type {import('./types.js').AwaitArgGuard} */ + /** @type {AwaitArgGuard} */ const result = makeTagged('guard:awaitArgGuard', { argGuard: argPattern, }); @@ -1812,7 +1816,7 @@ export const assertRawGuard = specimen => mustMatch(specimen, RawGuardShape, 'rawGuard'); /** - * @returns {import('./types.js').RawGuard} + * @returns {RawGuard} */ const makeRawGuard = () => makeTagged('guard:rawGuard', {}); @@ -1851,7 +1855,7 @@ export const MethodGuardShape = M.kind('guard:methodGuard'); /** * @param {any} specimen - * @returns {asserts specimen is import('./types.js').MethodGuard} + * @returns {asserts specimen is MethodGuard} */ export const assertMethodGuard = specimen => { mustMatch(specimen, MethodGuardShape, 'methodGuard'); @@ -1860,10 +1864,10 @@ harden(assertMethodGuard); /** * @param {'sync'|'async'} callKind - * @param {import('./types.js').ArgGuard[]} argGuards - * @param {import('./types.js').ArgGuard[]} [optionalArgGuards] - * @param {import('./types.js').SyncValueGuard} [restArgGuard] - * @returns {import('./types.js').MethodGuardMaker} + * @param {ArgGuard[]} argGuards + * @param {ArgGuard[]} [optionalArgGuards] + * @param {SyncValueGuard} [restArgGuard] + * @returns {MethodGuardMaker} */ const makeMethodGuardMaker = ( callKind, @@ -1889,7 +1893,7 @@ const makeMethodGuardMaker = ( ); }, returns: (returnGuard = M.undefined()) => { - /** @type {import('./types.js').MethodGuard} */ + /** @type {MethodGuard} */ const result = makeTagged('guard:methodGuard', { callKind, argGuards, @@ -1918,7 +1922,7 @@ export const InterfaceGuardShape = M.kind('guard:interfaceGuard'); /** * @param {any} specimen - * @returns {asserts specimen is import('./types.js').InterfaceGuard} + * @returns {asserts specimen is InterfaceGuard} */ export const assertInterfaceGuard = specimen => { mustMatch(specimen, InterfaceGuardShape, 'interfaceGuard'); @@ -1926,11 +1930,11 @@ export const assertInterfaceGuard = specimen => { harden(assertInterfaceGuard); /** - * @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('./types.js').InterfaceGuard} + * @returns {InterfaceGuard} */ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { const { sloppy = false, defaultGuards = sloppy ? 'passable' : undefined } = @@ -1938,9 +1942,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('./types.js').MethodGuard]>} */ + /** @type {Array<[symbol, MethodGuard]>} */ const symbolMethodGuardsEntries = []; for (const key of ownKeys(methodGuards)) { const value = methodGuards[/** @type {string} */ (key)]; @@ -1950,7 +1954,7 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { stringMethodGuards[key] = value; } } - /** @type {import('./types.js').InterfaceGuard} */ + /** @type {InterfaceGuard} */ const result = makeTagged('guard:interfaceGuard', { interfaceName, methodGuards: stringMethodGuards, @@ -1960,7 +1964,7 @@ const makeInterfaceGuard = (interfaceName, methodGuards, options = {}) => { defaultGuards, }); assertInterfaceGuard(result); - return /** @type {import('./types.js').InterfaceGuard} */ (result); + return /** @type {InterfaceGuard} */ (result); }; const GuardPayloadShapes = harden({ diff --git a/packages/patterns/src/patterns/types.js b/packages/patterns/src/patterns/types.js index 3bcf00bbe3..bf828a47a6 100644 --- a/packages/patterns/src/patterns/types.js +++ b/packages/patterns/src/patterns/types.js @@ -2,49 +2,14 @@ export {}; -/** @typedef {import('@endo/pass-style').Passable} Passable */ -/** @typedef {import('@endo/pass-style').PassStyle} PassStyle */ -/** - * @template {string} [Tag=string] - * @template {Passable} [Payload=Passable] - * @typedef {import('@endo/pass-style').CopyTagged} CopyTagged - */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('@endo/pass-style').CopyRecord} CopyRecord - */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('@endo/pass-style').CopyArray} CopyArray - */ -/** @typedef {import('@endo/pass-style').Checker} Checker */ -/** @typedef {import('@endo/marshal').RankCompare} RankCompare */ -/** @typedef {import('@endo/marshal').RankCover} RankCover */ - -/** @typedef {import('../types.js').AwaitArgGuardPayload} AwaitArgGuardPayload */ -/** @typedef {import('../types.js').AwaitArgGuard} AwaitArgGuard */ -/** @typedef {import('../types.js').RawGuard} RawGuard */ -/** @typedef {import('../types.js').ArgGuard} ArgGuard */ -/** @typedef {import('../types.js').MethodGuardPayload} MethodGuardPayload */ -/** @typedef {import('../types.js').SyncValueGuard} SyncValueGuard */ -/** @typedef {import('../types.js').MethodGuard} MethodGuard */ -/** - * @template {Record} [T=Record] - * @typedef {import('../types.js').InterfaceGuardPayload} InterfaceGuardPayload - */ -/** - * @template {Record} [T = Record] - * @typedef {import('../types.js').InterfaceGuard} InterfaceGuard - */ -/** @typedef {import('../types.js').MethodGuardMaker} MethodGuardMaker */ +/** @import {Passable} from '@endo/pass-style' */ +/** @import {PassStyle} from '@endo/pass-style' */ +/** @import {Checker} from '@endo/pass-style' */ +/** @import {MethodGuard} from '../types.js' */ -/** @typedef {import('../types').MatcherNamespace} MatcherNamespace */ -/** @typedef {import('../types').Key} Key */ -/** @typedef {import('../types').Pattern} Pattern */ -/** @typedef {import('../types').CheckPattern} CheckPattern */ -/** @typedef {import('../types').Limits} Limits */ -/** @typedef {import('../types').AllLimits} AllLimits */ -/** @typedef {import('../types').GetRankCover} GetRankCover */ +/** @import {MatcherNamespace} from '../types' */ +/** @import {Pattern} from '../types' */ +/** @import {GetRankCover} from '../types' */ /** * @typedef {Exclude | diff --git a/packages/patterns/src/types.js b/packages/patterns/src/types.js index b7019dea3e..671a75b286 100644 --- a/packages/patterns/src/types.js +++ b/packages/patterns/src/types.js @@ -2,24 +2,9 @@ export {}; -/** @typedef {import('@endo/pass-style').Passable} Passable */ -/** @typedef {import('@endo/pass-style').PassStyle} PassStyle */ -/** - * @template {string} [Tag=string] - * @template {Passable} [Payload=Passable] - * @typedef {import('@endo/pass-style').CopyTagged} CopyTagged - */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('@endo/pass-style').CopyRecord} CopyRecord - */ -/** - * @template {Passable} [T=Passable] - * @typedef {import('@endo/pass-style').CopyArray} CopyArray - */ -/** @typedef {import('@endo/pass-style').Checker} Checker */ -/** @typedef {import('@endo/marshal').RankCompare} RankCompare */ -/** @typedef {import('@endo/marshal').RankCover} RankCover */ +/** @import {Checker, CopyArray, CopyRecord, CopyTagged, Passable} from '@endo/pass-style' */ +/** @import {PassStyle} from '@endo/pass-style' */ +/** @import {RankCompare, RankCover} from '@endo/marshal' */ /** * @typedef {Passable} Key