Skip to content

Commit

Permalink
misc type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jan 27, 2022
1 parent e8a7bac commit ab8aad4
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/SwingSet/src/hasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assert } from '@agoric/assert';
import { createHash } from 'crypto';

/**
* @typedef { (initial: string?) => {
* @typedef { (initial?: string?) => {
* add: (more: string) => void,
* finish: () => string,
* }
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/state/storageWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function* mergeSortedIterators(it1, it2) {
* that buffers any mutations until told to commit them.
*
* @param {*} kvStore The storage object that this crank buffer will be based on.
* @param {CreateSHA256} createSHA256
* @param {import('../../hasher.js').CreateSHA256} createSHA256
* @param { (key: string) => boolean } isConsensusKey
* @returns {*} an object {
* crankBuffer, // crank buffer as described, wrapping `kvStore`
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function makeCache(size, fetch, store) {
* in memory.
* @param {*} FinalizationRegistry Powerful JavaScript intrinsic normally denied by SES
* @param {*} addToPossiblyDeadSet Function to record objects whose deaths should be reinvestigated
* @param {*} addToPossiblyRetiredSet Function to record dead objects whose retirement should be
* @param {*=} addToPossiblyRetiredSet Function to record dead objects whose retirement should be
* reinvestigated
*
* @returns {Object} a new virtual object manager.
Expand Down
7 changes: 7 additions & 0 deletions packages/SwingSet/src/spawnSubprocessWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ function parentLog(first, ...args) {
// always be Node.
const stdio = harden(['inherit', 'inherit', 'inherit', 'pipe', 'pipe']);

/**
*
* @param {string} execPath
* @param {string[]} procArgs
* @returns {object}
*/
export function startSubprocessWorker(execPath, procArgs = []) {
/** @type {ChildProcessByStdio<null, null, Readable>} */
const proc = spawn(execPath, procArgs, { stdio });

const toChild = arrayEncoderStream();
Expand Down
7 changes: 6 additions & 1 deletion packages/SwingSet/src/worker-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ export function arrayEncoderStream() {
}

export function arrayDecoderStream() {
/**
* @param {any} buf
* @param {BufferEncoding} encoding
* @param {TransformCallback} callback
*/
function transform(buf, encoding, callback) {
let err;
try {
if (!Buffer.isBuffer(buf)) {
throw Error('stream expects Buffers');
}
this.push(JSON.parse(buf));
this.push(JSON.parse(buf.toString(encoding)));
} catch (e) {
err = e;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/promise-kit/src/promiseKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const BestPipelinablePromise = globalThis.HandledPromise || Promise;
/**
* @template T
* @typedef {Object} PromiseKit A reified Promise
* @property {(value: ERef<T>) => void} resolve
* @property {(value?: ERef<T>) => void} resolve
* @property {(reason: any) => void} reject
* @property {Promise<T>} promise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
import '@agoric/zoe/exported.js';
import 'ses';
import '../../src/vaultFactory/types.js';

import { resolve as importMetaResolve } from 'import-meta-resolve';
Expand Down
2 changes: 1 addition & 1 deletion packages/zoe/src/contractFacet/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
* @param {Keyword} keyword
* @param {FeeMintAccess} allegedFeeMintAccess - an object that
* purports to be the object that grants access to the fee mint
* @returns {Promise<ZCFMint>
* @returns {Promise<ZCFMint>}
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/zoe/src/contractSupport/statistics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @template T
* @template {number | bigint} T
* @typedef {Object} TypedMath
* @property {(a: T, b: T) => T} add
* @property {(a: T, b: T) => T} divide
Expand All @@ -9,7 +9,7 @@
/**
* Calculate the median of a set of samples
*
* @template T
* @template {number | bigint} T
* @param {Array<T>} samples the input measurements
* @param {TypedMath<T>} math
* @returns {T=} the median (undefined if no samples)
Expand Down
2 changes: 1 addition & 1 deletion packages/zoe/src/issuerRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @param {Brand} brand
* @param {Issuer} issuer
* @param {DisplayInfo=} displayInfo
* @param {DisplayInfo} displayInfo
* @returns {IssuerRecord}
*/
export const makeIssuerRecord = (brand, issuer, displayInfo) =>
Expand Down

0 comments on commit ab8aad4

Please sign in to comment.