From 6b4182963cbc87b6eb22b77833e420fa35bb2da6 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 11 Jul 2024 13:49:40 -0700 Subject: [PATCH] fix(types): TypedMatcher --> TypedPattern --- .../inter-protocol/src/auction/auctionBook.js | 2 +- .../inter-protocol/src/auction/auctioneer.js | 2 +- .../src/price/fluxAggregatorKit.js | 4 ++-- packages/inter-protocol/src/psm/psm.js | 2 +- .../src/reserve/assetReserveKit.js | 2 +- .../src/vaultFactory/vaultDirector.js | 2 +- packages/zoe/src/contractSupport/recorder.js | 17 +++++++---------- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index 3b373c79a79..be91b29a370 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -172,7 +172,7 @@ export const prepareAuctionBook = (baggage, zcf, makeRecorderKit) => { const bookDataKit = makeRecorderKit( node, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern} */ ( M.any() ), ); diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index 6d6b2d021a1..b2d480ab3dd 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -440,7 +440,7 @@ export const start = async (zcf, privateArgs, baggage) => { const scheduleKit = makeERecorderKit( E(privateArgs.storageNode).makeChildNode('schedule'), /** - * @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher< + * @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern< * import('./scheduler.js').ScheduleNotification * >} */ (M.any()), diff --git a/packages/inter-protocol/src/price/fluxAggregatorKit.js b/packages/inter-protocol/src/price/fluxAggregatorKit.js index 164a5997da6..70b3e1d58ed 100644 --- a/packages/inter-protocol/src/price/fluxAggregatorKit.js +++ b/packages/inter-protocol/src/price/fluxAggregatorKit.js @@ -144,7 +144,7 @@ export const prepareFluxAggregatorKit = async ( priceKit: () => makeRecorderKit( storageNode, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern} */ ( M.any() ), ), @@ -153,7 +153,7 @@ export const prepareFluxAggregatorKit = async ( makeRecorderKit( node, /** - * @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher< + * @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern< * import('./roundsManager.js').LatestRound * >} */ (M.any()), diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index f19e1cb9fe2..113a6f7ab6e 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -174,7 +174,7 @@ export const start = async (zcf, privateArgs, baggage) => { E.when(E(privateArgs.storageNode).makeChildNode('metrics'), node => makeRecorderKit( node, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern} */ ( M.any() ), ), diff --git a/packages/inter-protocol/src/reserve/assetReserveKit.js b/packages/inter-protocol/src/reserve/assetReserveKit.js index b21da11e2fe..673901e46de 100644 --- a/packages/inter-protocol/src/reserve/assetReserveKit.js +++ b/packages/inter-protocol/src/reserve/assetReserveKit.js @@ -88,7 +88,7 @@ export const prepareAssetReserveKit = async ( keywordForBrand, metricsKit: makeRecorderKit( metricsNode, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern} */ ( M.any() ), ), diff --git a/packages/inter-protocol/src/vaultFactory/vaultDirector.js b/packages/inter-protocol/src/vaultFactory/vaultDirector.js index 5eea587cd44..cb221c938b3 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultDirector.js +++ b/packages/inter-protocol/src/vaultFactory/vaultDirector.js @@ -131,7 +131,7 @@ const prepareVaultDirector = ( const metricsKit = makeERecorderKit( metricsNode, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedPattern} */ ( M.any() ), ); diff --git a/packages/zoe/src/contractSupport/recorder.js b/packages/zoe/src/contractSupport/recorder.js index 65c0d7d324d..a0c81562400 100644 --- a/packages/zoe/src/contractSupport/recorder.js +++ b/packages/zoe/src/contractSupport/recorder.js @@ -56,12 +56,12 @@ export const prepareRecorder = (baggage, marshaller) => { * @template T * @param {PublishKit['publisher']} publisher * @param {Awaited>} storageNode - * @param {TypedMatcher} [valueShape] + * @param {TypedPattern} [valueShape] */ ( publisher, storageNode, - valueShape = /** @type {TypedMatcher} */ (M.any()), + valueShape = /** @type {TypedPattern} */ (M.any()), ) => { return { closed: false, @@ -145,7 +145,7 @@ export const defineRecorderKit = ({ makeRecorder, makeDurablePublishKit }) => { /** * @template T * @param {StorageNode | Awaited>} storageNode - * @param {TypedMatcher} [valueShape] + * @param {TypedPattern} [valueShape] * @returns {RecorderKit} */ const makeRecorderKit = (storageNode, valueShape) => { @@ -174,7 +174,7 @@ export const defineERecorderKit = ({ makeRecorder, makeDurablePublishKit }) => { /** * @template T * @param {ERef} storageNodeP - * @param {TypedMatcher} [valueShape] + * @param {TypedPattern} [valueShape] * @returns {EventualRecorderKit} */ const makeERecorderKit = (storageNodeP, valueShape) => { @@ -263,14 +263,11 @@ export const prepareMockRecorderKitMakers = () => { * Stop-gap until https://github.com/Agoric/agoric-sdk/issues/6160 * explictly specify the type that the Pattern will verify through a match. * - * This is a Pattern but since that's `any`, including in the typedef turns the - * whole thing to `any`. - * * @template T - * @typedef {import('@endo/patterns').Matcher & { validatedType?: T }} TypedMatcher + * @typedef {import('@endo/patterns').Pattern & { validatedType?: T }} TypedPattern */ /** - * @template {TypedMatcher} TM - * @typedef {TM extends TypedMatcher ? T : never} MatchedType + * @template {TypedPattern} TM + * @typedef {TM extends TypedPattern ? T : never} MatchedType */