Skip to content

Commit

Permalink
chore(types): s/ts-ignore/ts-expect-error
Browse files Browse the repository at this point in the history
we've solved #4620
  • Loading branch information
turadg committed Mar 28, 2024
1 parent 57482d7 commit 75e60d4
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 52 deletions.
14 changes: 6 additions & 8 deletions packages/ERTP/src/paymentLedger.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export const preparePaymentLedger = (
// Should be
// at-ts-expect-error XXX callWhen
// but ran into the usual disagreement between local lint and CI
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore

// @ts-expect-error
const brand = issuerZone.exo(`${name} brand`, BrandI, {
isMyIssuer(allegedIssuer) {
// BrandI delays calling this method until `allegedIssuer` is a Remotable
Expand Down Expand Up @@ -311,8 +311,8 @@ export const preparePaymentLedger = (
// Should be
// at-ts-expect-error cast due to callWhen discrepancy
// but ran into the usual disagreement between local lint and CI
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore

// @ts-expect-error
const issuer = issuerZone.exo(`${name} issuer`, IssuerI, {
getBrand() {
return brand;
Expand Down Expand Up @@ -371,8 +371,7 @@ export const preparePaymentLedger = (
// at-ts-expect-error checked cast
// but ran into the usual disagreement between local lint and IDE lint.
// Don't know yet about lint under CI.
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore

const mintRecoveryPurse = /** @type {Purse<K>} */ (
issuerZone.makeOnce('mintRecoveryPurse', () => makeEmptyPurse())
);
Expand All @@ -386,8 +385,7 @@ export const preparePaymentLedger = (
// Should be
// at-ts-expect-error checked cast
// but ran into the usual disagreement between local lint and CI
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore

newAmount = coerce(newAmount);
mustMatch(newAmount, amountShape, 'minted amount');
// `rawPayment` is not associated with any recovery set, and
Expand Down
3 changes: 1 addition & 2 deletions packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
import { Nat, isNat } from '@endo/nat';
import { assert, Fail } from '@agoric/assert';
import { initializeVatState, makeVatKeeper } from './vatKeeper.js';
Expand Down Expand Up @@ -179,7 +178,7 @@ export default function makeKernelKeeper(kernelStorage, kernelSlog) {
*/
function getRequired(key) {
kvStore.has(key) || Fail`storage lacks required key ${key}`;
// @ts-ignore already checked .has()
// @ts-expect-error already checked .has()
return kvStore.get(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export function makeXsSubprocessFactory({
parentLog(vatID, `deliverDone`, result.reply[0], result.reply.length);
// Attach the meterUsage to the deliver result.
/** @type { VatDeliveryResult } */
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore I don't know how to appease tsc

// @ts-expect-error I don't know how to appease tsc
const deliverResult = harden([
result.reply[0], // 'ok' or 'error'
result.reply[1] || null, // results or problem or null
Expand Down
4 changes: 2 additions & 2 deletions packages/SwingSet/test/upgrade/test-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ const testUpgrade = async (t, defaultManagerType, options = {}) => {
const { data: bundleData } = t.context;
if (suppressGC) {
config.defaultReapInterval = 'never';
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore reapInterval is valid

// @ts-expect-error reapInterval is valid
config.vats.bootstrap.reapInterval = 1;
}
const {
Expand Down
3 changes: 1 addition & 2 deletions packages/base-zone/src/prepare-revocable.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ export const prepareRevocableKit = (
},
);

// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore parameter confusion
// @ts-expect-error parameter confusion
return makeRevocableKit;
};
harden(prepareRevocableKit);
3 changes: 1 addition & 2 deletions packages/cosmic-swingset/calc-rpcport.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import toml from '@iarna/toml';

const configString = fs.readFileSync(process.argv[2]).toString();
const config = toml.parse(configString);
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore Property 'laddr' does not exist on type 'AnyJson'
// @ts-expect-error Property 'laddr' does not exist on type 'AnyJson'
const { laddr } = config.rpc; // like tcp://0.0.0.0:26657
// eslint-disable-next-line no-useless-escape
const m = laddr.match(/^tcp:\/\/([\d\.]+):(\d+)$/);
Expand Down
2 changes: 0 additions & 2 deletions packages/deploy-script-support/src/extract-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ export const extractCoreProposalBundles = async (
/** @type {import('./externalTypes.js').PublishBundleRef} */
const publishRef = async handleP => {
const handle = await handleP;
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
// @ts-ignore xxx types
bundleHandleToAbsolutePaths.has(handle) ||
Fail`${handle} not in installed bundles`;
return handle;
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/contractGovernance/paramManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ const makeParamManagerBuilder = (publisherKit, zoe) => {
throw Fail`zoe must be provided for governed Invitations ${zoe}`;
}
const { instance, installation } = await E(zoe).getInvitationDetails(i);
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- the build config doesn't expect an error here
// @ts-ignore typedefs say they're guaranteed truthy but just to be safe

// @ts-expect-error typedefs say they're guaranteed truthy but just to be safe
assert(instance && installation, 'must be an invitation');
};

Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/contractGovernor.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export const start = async (zcf, privateArgs, baggage) => {
const startedInstanceKit = await E(zoe).startInstance(
governedContractInstallation,
governedIssuerKeywordRecord,
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- the build config doesn't expect an error here
// @ts-ignore XXX governance types https://github.com/Agoric/agoric-sdk/issues/7178

// @ts-expect-error XXX governance types https://github.com/Agoric/agoric-sdk/issues/7178
augmentedTerms,
privateArgs.governed,
governedContractLabel,
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/contractGovernorKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ export const prepareContractGovernorKit = (baggage, powers) => {
replaceElectorate(poserInvitation) {
const { creatorFacet } = this.state;
/** @type {Promise<import('./contractGovernance/typedParamManager.js').TypedParamManager<{'Electorate': 'invitation'}>>} */
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- the build config doesn't expect an error here
// @ts-ignore cast

// @ts-expect-error cast
const paramMgr = E(E(creatorFacet).getParamMgrRetriever()).get({
key: 'governedParams',
});
Expand Down
5 changes: 2 additions & 3 deletions packages/notifier/test/test-publish-kit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
/* eslint-disable no-void */

import '@agoric/swingset-liveslots/tools/prepare-test-env.js';
Expand Down Expand Up @@ -145,7 +144,7 @@ const verifyPublishKit = test.macro(async (t, makePublishKit) => {
cells.set(thirdPublishCount, thirdCells[0]);

t.throws(
// @ts-ignore deliberate testing of invalid invocation
// @ts-expect-error deliberate testing of invalid invocation
() => subscriber.subscribeAfter(Number(secondPublishCount)),
{ message: /bigint/ },
);
Expand Down Expand Up @@ -190,7 +189,7 @@ const verifySubscribeAfter = test.macro(async (t, makePublishKit) => {
)();
for (const badCount of [1n, 0, '', false, Symbol('symbol'), {}]) {
t.throws(
// @ts-ignore deliberate invalid arguments for testing
// @ts-expect-error deliberate invalid arguments for testing
() => subscriber.subscribeAfter(badCount),
undefined,
`subscribeAfter must reject invalid publish count: ${typeof badCount} ${q(
Expand Down
9 changes: 3 additions & 6 deletions packages/swingset-liveslots/src/virtualObjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,7 @@ export const makeVirtualObjectManager = (
// actually carry the InterfaceGuardKit.
//
// Tolerating the old vat-data with the new types.
// at-expect-error here causes inconsistent reports, so
// doing the at-ts-ignore-error ritual instead.
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore
// @ts-expect-error
interfaceGuardKit = interfaceGuard;
interfaceGuard = undefined;
// The rest of the code from here makes no further compromise
Expand Down Expand Up @@ -1254,8 +1251,8 @@ export const makeVirtualObjectManager = (
saveDurableKindDescriptor(durableKindDescriptor);
saveNextInstanceID(kindID);
/** @type {DurableKindHandle} */
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620
// @ts-ignore cast

// @ts-expect-error cast
const kindHandle = Far('kind', {});
kindHandleToID.set(kindHandle, kindID);
const kindIDvref = makeBaseRef(kindIDID, kindID, true);
Expand Down
10 changes: 5 additions & 5 deletions packages/vat-data/src/exo-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @jessie-check
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- for casting from deprecated types that aren't worth fixing */

import { initEmpty } from '@agoric/store';

import { provide, VatData as globalVatData } from './vat-data-bindings.js';
Expand Down Expand Up @@ -106,7 +106,7 @@ export const makeExoUtils = VatData => {
* @returns {(...args: Parameters<I>) => import('@endo/exo/src/exo-makers.js').Guarded<T>}
*/
const defineVirtualExoClass = (tag, interfaceGuard, init, methods, options) =>
// @ts-ignore cast
// @ts-expect-error cast
defineKind(tag, init, methods, {
...options,
thisfulMethods: true,
Expand Down Expand Up @@ -137,7 +137,7 @@ export const makeExoUtils = VatData => {
facets,
options,
) =>
// @ts-ignore cast
// @ts-expect-error cast
defineKindMulti(tag, init, facets, {
...options,
thisfulMethods: true,
Expand Down Expand Up @@ -168,7 +168,7 @@ export const makeExoUtils = VatData => {
methods,
options,
) =>
// @ts-ignore cast
// @ts-expect-error cast
defineDurableKind(kindHandle, init, methods, {
...options,
thisfulMethods: true,
Expand Down Expand Up @@ -199,7 +199,7 @@ export const makeExoUtils = VatData => {
facets,
options,
) =>
// @ts-ignore cast
// @ts-expect-error cast
defineDurableKindMulti(kindHandle, init, facets, {
...options,
thisfulMethods: true,
Expand Down
5 changes: 0 additions & 5 deletions packages/vat-data/test/test-is-instance-virtual-class-kits.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// modeled on test-is-instance-heap-class-kits.js

// eslint-disable-next-line import/order
import { test } from './prepare-test-env-ava.js';

// eslint-disable-next-line import/order
Expand All @@ -19,8 +18,6 @@ const DownCounterI = M.interface('DownCounter', {
});

test('test isInstance defineVirtualExoClass', t => {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore IsInstance merged after last sync with endo
/** @type {import('@endo/exo/src/exo-makers.js').IsInstance} */
let isInstance;
const makeUpCounter = defineVirtualExoClass(
Expand Down Expand Up @@ -62,8 +59,6 @@ test('test isInstance defineVirtualExoClass', t => {
});

test('test isInstance defineVirtualExoClassKit', t => {
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore IsInstance merged after last sync with endo
/** @type {import('@endo/exo/src/exo-makers.js').IsInstance} */
let isInstance;
const makeCounterKit = defineVirtualExoClassKit(
Expand Down
4 changes: 2 additions & 2 deletions packages/vats/src/nameHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export const prepareNameHubKit = zone => {
if (keyToAdmin.has(key)) {
const childAdmin = keyToAdmin.get(key);
/** @type {import('./types.js').NameHub} */
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore if an admin is present, it should be a namehub

// @ts-expect-error if an admin is present, it should be a namehub
const childHub = keyToValue.get(key);
return { nameHub: childHub, nameAdmin: childAdmin };
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vats/src/vat-provisioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const prepareSpecializedNameAdmin = zone => {
// TODO: enforce?

/** @type {import('./types.js').MyAddressNameAdmin} */
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore cast

// @ts-expect-error cast
const myAdmin = nameAdmin.lookupAdmin(address);
return myAdmin;
},
Expand Down
5 changes: 2 additions & 3 deletions packages/zoe/src/zoeService/installationStorage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- accomodate different type search depths */
import { assert } from '@agoric/assert';
import {
M,
Expand Down Expand Up @@ -39,7 +38,7 @@ export const makeInstallationStorage = (getBundleCapForID, zoeBaggage) => {
zoeBaggage,
'BundleIDInstallation',
bundleLabel => ({ bundleLabel }),
// @ts-ignore cast without StartFunction property
// @ts-expect-error cast without StartFunction property
{
getBundle: _context => Fail`bundleID-based Installation`,
getBundleLabel: ({ state: { bundleLabel } }) => bundleLabel,
Expand All @@ -51,7 +50,7 @@ export const makeInstallationStorage = (getBundleCapForID, zoeBaggage) => {
zoeBaggage,
'BundleInstallation',
(bundle, bundleLabel) => ({ bundle, bundleLabel }),
// @ts-ignore cast without StartFunction property
// @ts-expect-error cast without StartFunction property
{
getBundle: ({ state: { bundle } }) => bundle,
getBundleLabel: ({ state: { bundleLabel } }) => bundleLabel,
Expand Down

0 comments on commit 75e60d4

Please sign in to comment.