From 5baf10678ba8fb82392e88b3a5cf9cb41d2d60a9 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 10 Jan 2024 11:19:03 -0800 Subject: [PATCH] fixes to get types building --- packages/marshal/src/rankOrder.js | 1 + packages/marshal/src/types.js | 4 ++-- packages/pass-style/src/makeTagged.js | 2 +- packages/pass-style/src/typeGuards.js | 16 ++++++++-------- packages/pass-style/tools/arb-passable.js | 7 ++++++- packages/patterns/src/keys/checkKey.js | 14 +++++++------- packages/patterns/src/keys/copyBag.js | 2 +- packages/patterns/src/keys/copySet.js | 2 +- .../patterns/src/keys/merge-bag-operators.js | 4 ++-- 9 files changed, 29 insertions(+), 23 deletions(-) diff --git a/packages/marshal/src/rankOrder.js b/packages/marshal/src/rankOrder.js index e8167d9489..db67b43b13 100644 --- a/packages/marshal/src/rankOrder.js +++ b/packages/marshal/src/rankOrder.js @@ -1,3 +1,4 @@ +// @ts-nocheck FIXME before merge import { getTag, passStyleOf, nameForPassableSymbol } from '@endo/pass-style'; import { passStylePrefixes, diff --git a/packages/marshal/src/types.js b/packages/marshal/src/types.js index ce8c84d71e..5ac06ce43e 100644 --- a/packages/marshal/src/types.js +++ b/packages/marshal/src/types.js @@ -172,8 +172,8 @@ export {}; * ordering would also compare magnitudes, and so agree with the rank ordering * of all values other than `NaN`. An array sorted by rank would enable range * queries by magnitude. - * @param {Passable} left - * @param {Passable} right + * @param {import("@endo/pass-style").Passable} left + * @param {import("@endo/pass-style").Passable} right * @returns {RankComparison} */ diff --git a/packages/pass-style/src/makeTagged.js b/packages/pass-style/src/makeTagged.js index b4e6c08c2e..90f5ffad5f 100644 --- a/packages/pass-style/src/makeTagged.js +++ b/packages/pass-style/src/makeTagged.js @@ -8,7 +8,7 @@ const { Fail } = assert; /** * @template {string} T - * @template {any} P + * @template {import('./types.js').Passable} P * @param {T} tag * @param {P} payload * @returns {import('./types.js').CopyTagged} diff --git a/packages/pass-style/src/typeGuards.js b/packages/pass-style/src/typeGuards.js index 03cba60c6d..ffc6e7c398 100644 --- a/packages/pass-style/src/typeGuards.js +++ b/packages/pass-style/src/typeGuards.js @@ -17,8 +17,8 @@ const { Fail, quote: q } = assert; * Check whether the argument is a pass-by-copy array, AKA a "copyArray" * in @endo/marshal terms * - * @param {unknown} arr - * @returns {arr is CopyArray} + * @param {any} arr + * @returns {arr is CopyArray} */ const isCopyArray = arr => passStyleOf(arr) === 'copyArray'; harden(isCopyArray); @@ -27,8 +27,8 @@ harden(isCopyArray); * Check whether the argument is a pass-by-copy record, AKA a * "copyRecord" in @endo/marshal terms * - * @param {unknown} record - * @returns {record is CopyRecord} + * @param {any} record + * @returns {record is CopyRecord} */ const isRecord = record => passStyleOf(record) === 'copyRecord'; harden(isRecord); @@ -43,9 +43,9 @@ const isRemotable = remotable => passStyleOf(remotable) === 'remotable'; harden(isRemotable); /** - * @param {unknown} array + * @param {any} array * @param {string=} optNameOfArray - * @returns {asserts array is CopyArray} + * @returns {asserts array is CopyArray} */ const assertCopyArray = (array, optNameOfArray = 'Alleged array') => { const passStyle = passStyleOf(array); @@ -57,9 +57,9 @@ const assertCopyArray = (array, optNameOfArray = 'Alleged array') => { harden(assertCopyArray); /** - * @param {unknown} record + * @param {any} record * @param {string=} optNameOfRecord - * @returns {asserts record is CopyRecord} + * @returns {asserts record is CopyRecord} */ const assertRecord = (record, optNameOfRecord = 'Alleged record') => { const passStyle = passStyleOf(record); diff --git a/packages/pass-style/tools/arb-passable.js b/packages/pass-style/tools/arb-passable.js index 1d6651cdec..22549f5d83 100644 --- a/packages/pass-style/tools/arb-passable.js +++ b/packages/pass-style/tools/arb-passable.js @@ -99,7 +99,12 @@ const { arbDag } = fc.letrec(tie => { ), }), ) - .map(({ type, payload }) => makeTagged(type, payload)), + .map(({ type, payload }) => + makeTagged( + type, + /** @type {import('../src/types.js').Passable} */ (payload), + ), + ), ), }; }); diff --git a/packages/patterns/src/keys/checkKey.js b/packages/patterns/src/keys/checkKey.js index a80e91bfba..d2014db1b8 100644 --- a/packages/patterns/src/keys/checkKey.js +++ b/packages/patterns/src/keys/checkKey.js @@ -199,7 +199,7 @@ export const assertCopySet = s => { harden(assertCopySet); /** - * @template K + * @template {Key} K * @param {CopySet} s * @returns {K[]} */ @@ -210,7 +210,7 @@ export const getCopySetKeys = s => { harden(getCopySetKeys); /** - * @template K + * @template {Key} K * @param {CopySet} s * @param {(key: K, index: number) => boolean} fn * @returns {boolean} @@ -220,7 +220,7 @@ export const everyCopySetKey = (s, fn) => harden(everyCopySetKey); /** - * @template K + * @template {Key} K * @param {Iterable} elementIter * @returns {CopySet} */ @@ -283,7 +283,7 @@ export const assertCopyBag = b => { harden(assertCopyBag); /** - * @template K + * @template {Key} K * @param {CopyBag} b * @returns {CopyBag['payload']} */ @@ -294,7 +294,7 @@ export const getCopyBagEntries = b => { harden(getCopyBagEntries); /** - * @template K + * @template {Key} K * @param {CopyBag} b * @param {(entry: [K, bigint], index: number) => boolean} fn * @returns {boolean} @@ -304,7 +304,7 @@ export const everyCopyBagEntry = (b, fn) => harden(everyCopyBagEntry); /** - * @template K + * @template {Key} K * @param {Iterable<[K,bigint]>} bagEntryIter * @returns {CopyBag} */ @@ -316,7 +316,7 @@ export const makeCopyBag = bagEntryIter => { harden(makeCopyBag); /** - * @template K + * @template {Key} K * @param {Iterable} elementIter * @returns {CopyBag} */ diff --git a/packages/patterns/src/keys/copyBag.js b/packages/patterns/src/keys/copyBag.js index fc9cf0f53b..6fad508d49 100644 --- a/packages/patterns/src/keys/copyBag.js +++ b/packages/patterns/src/keys/copyBag.js @@ -123,7 +123,7 @@ export const coerceToBagEntries = bagEntriesList => { harden(coerceToBagEntries); /** - * @template K + * @template {import('../types.js').Key} K * @param {Iterable<[K, bigint]>} bagEntryIter * @returns {CopyBag} */ diff --git a/packages/patterns/src/keys/copySet.js b/packages/patterns/src/keys/copySet.js index b17ac56f71..315fa950ee 100644 --- a/packages/patterns/src/keys/copySet.js +++ b/packages/patterns/src/keys/copySet.js @@ -97,7 +97,7 @@ export const coerceToElements = elementsList => { harden(coerceToElements); /** - * @template K + * @template {import('../types.js').Key} K * @param {Iterable} elementIter * @returns {CopySet} */ diff --git a/packages/patterns/src/keys/merge-bag-operators.js b/packages/patterns/src/keys/merge-bag-operators.js index 88a1ce1e50..2ae5675f24 100644 --- a/packages/patterns/src/keys/merge-bag-operators.js +++ b/packages/patterns/src/keys/merge-bag-operators.js @@ -29,7 +29,7 @@ const { quote: q, Fail } = assert; * to `fullOrder`. However, it optimizes for the case where these contiguous * runs that need to be resorted are either absent or small. * - * @template T + * @template {import('../types').Passable} T * @param {[T,bigint][]} bagEntries * @param {RankCompare} rankCompare * @param {FullCompare} fullCompare @@ -96,7 +96,7 @@ const bagWindowResort = (bagEntries, rankCompare, fullCompare) => { * For sets, these counts are always 0 or 1, but this representation * generalizes nicely for bags. * - * @template T + * @template {import('../types').Passable} T * @param {[T,bigint][]} xbagEntries * @param {[T,bigint][]} ybagEntries * @returns {Iterable<[T,bigint,bigint]>}