Skip to content

Commit

Permalink
fix(marshal): Work around TypeScript issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Dec 7, 2022
1 parent 146d69e commit 5f39520
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/marshal/src/encodePassable.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,12 @@ const decodeTagged = (encoded, decodePassable) => {
*/

/**
* @param {EncodeOptions} [encodeOptions]
* @param {EncodeOptions} encodeOptions
* @returns {(passable: Passable) => string}
*
* encodeOptions is actually optional, but not marked as such to work around
* https://github.com/microsoft/TypeScript/issues/50286
*/
// `yarn lint` complains here but not for equivalent code in agoric-sdk.
// Also, vscode does not complain. Hence we're using at-ts-ignore rather than
// at-ts-expect-error. Using at-ts-ignore should also generate a complaint
// that we should be using at-expect-error, where we would normally need
// to suppress that error as well. However, perhaps that second error currently
// happens only in agoric-sdk, but not yet in endo. TODO figure out and fix.
// @ts-ignore
export const makeEncodePassable = ({
encodeRemotable = (rem, _) => Fail`remotable unexpected: ${rem}`,
encodePromise = (prom, _) => Fail`promise unexpected: ${prom}`,
Expand Down
3 changes: 3 additions & 0 deletions packages/marshal/src/encodeToCapData.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const dontEncodeErrorToCapData = err => Fail`error object unexpected: ${err}`;
/**
* @param {EncodeToCapDataOptions} encodeOptions
* @returns {(passable: Passable) => Encoding}
*
* encodeOptions is actually optional, but not marked as such to work around
* https://github.com/microsoft/TypeScript/issues/50286
*/
export const makeEncodeToCapData = ({
encodeRemotableToCapData = dontEncodeRemotableToCapData,
Expand Down
3 changes: 3 additions & 0 deletions packages/marshal/src/encodeToSmallcaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const dontEncodeErrorToSmallcaps = err =>
/**
* @param {EncodeToSmallcapsOptions} encodeOptions
* @returns {(passable: Passable) => SmallcapsEncoding}
*
* encodeOptions is actually optional, but not marked as such to work around
* https://github.com/microsoft/TypeScript/issues/50286
*/
export const makeEncodeToSmallcaps = ({
encodeRemotableToSmallcaps = dontEncodeRemotableToSmallcaps,
Expand Down

0 comments on commit 5f39520

Please sign in to comment.