Skip to content

Commit

Permalink
chore(types): misc accomodations
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jan 10, 2024
1 parent 9aac68e commit 4cd95d9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/marshal/test/test-marshal-stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ test('marshal stringify errors', t => {
t.throws(() => stringify({}), {
message: /Cannot pass non-frozen objects like .*. Use harden()/,
});
// @ts-expect-error intentional error
t.throws(() => stringify(harden(new Uint8Array(1))), {
message: 'Cannot pass mutable typed arrays like "[Uint8Array]".',
});
// @ts-expect-error intentional error
t.throws(() => stringify(harden(new Int16Array(1))), {
message: 'Cannot pass mutable typed arrays like "[Int16Array]".',
});
Expand Down
1 change: 1 addition & 0 deletions packages/patterns/src/keys/checkKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ harden(assertScalarKey);

// @ts-expect-error Key does not satisfy WeakKey
/** @type {WeakSet<Key>} */
// @ts-expect-error Key does not satisfy WeakKey
const keyMemo = new WeakSet();

/**
Expand Down
1 change: 1 addition & 0 deletions packages/patterns/src/keys/copyBag.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const checkBagEntries = (bagEntries, check) => {
);
}
}
// @ts-expect-error FIXME Key types
return checkNoDuplicateKeys(bagEntries, undefined, check);
};
harden(checkBagEntries);
Expand Down
3 changes: 3 additions & 0 deletions packages/patterns/src/keys/keycollection-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const { quote: q, Fail } = assert;
* @returns {IterableIterator<[import('../types.js').Key, V]>}
*/
const generateFullSortedEntries = (entries, rankCompare, fullCompare) => {
// @ts-expect-error FIXME Key types
assertRankSorted(entries, rankCompare);
const { length } = entries;
let i = 0;
Expand Down Expand Up @@ -56,8 +57,10 @@ const generateFullSortedEntries = (entries, rankCompare, fullCompare) => {

// Sort the ties by `fullCompare`, enforce key uniqueness, and delegate to
// a sub-iterator.
// @ts-expect-error FIXME Key types
const sortedTies = sortByRank(ties, fullCompare);
for (let k = 1; k < sortedTies.length; k += 1) {
// @ts-expect-error FIXME Key types
const [key0] = sortedTies[k - 1];
const [key1] = sortedTies[k];
Math.sign(fullCompare(key0, key1)) ||
Expand Down
1 change: 1 addition & 0 deletions packages/patterns/src/keys/merge-bag-operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const bagWindowResort = (bagEntries, rankCompare, fullCompare) => {
// Providing the same `fullCompare` should cause a memo hit
// within `assertNoDuplicates` enabling it to avoid a
// redundant resorting.
// @ts-expect-error FIXME Key types
assertNoDuplicateKeys(resorted, fullCompare);
// This is the raw JS array iterator whose `.next()` method
// does not harden the IteratorResult, in violation of our
Expand Down

0 comments on commit 4cd95d9

Please sign in to comment.