Skip to content

Commit

Permalink
chore: types inconsistency hack
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Oct 25, 2022
1 parent 0d093be commit 4551371
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 18 deletions.
5 changes: 3 additions & 2 deletions packages/SwingSet/src/controller/controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-check
/* global globalThis, WeakRef, FinalizationRegistry */
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */

import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -287,9 +288,9 @@ export async function makeSwingsetController(
}

const bundles = [
// @ts-expect-error assume lockdownBundle is set
// @ts-ignore assume lockdownBundle is set
JSON.parse(kvStore.get('lockdownBundle')),
// @ts-expect-error assume supervisorBundle is set
// @ts-ignore assume supervisorBundle is set
JSON.parse(kvStore.get('supervisorBundle')),
];
const startXSnap = makeStartXSnap(bundles, {
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/src/kernel/kernelSyscall.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */

import { assert, details as X } from '@agoric/assert';
import { insistKernelType } from './parseKernelSlots.js';
Expand Down Expand Up @@ -207,8 +208,10 @@ export function makeKernelSyscallHandler(tools) {
workingLowerBound = actualLowerBound;
workingUpperBound = actualUpperBound;
workingKeyIterator = kvStore.getKeys(startKey, actualUpperBound);
// @ts-ignore some resolution thinks this is undefined
nextIter = workingKeyIterator.next();
if (!nextIter.done && nextIter.value === actualPriorKey) {
// @ts-ignore some resolution thinks this is undefined
nextIter = workingKeyIterator.next();
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */
import { Nat, isNat } from '@agoric/nat';
import { assert, details as X } from '@agoric/assert';
import { wrapStorage } from './storageWrapper.js';
Expand Down Expand Up @@ -199,7 +200,7 @@ export default function makeKernelKeeper(
*/
function getRequired(key) {
assert(kvStore.has(key), X`storage lacks required key ${key}`);
// @ts-expect-error already checked .has()
// @ts-ignore already checked .has()
return kvStore.get(key);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/deploy-script-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
"lint:eslint": "eslint .",
"lint:types": "tsc --maxNodeModuleJsDepth 5 -p jsconfig.json",
"lint:types": "tsc -p jsconfig.json",
"lint": "run-s --continue-on-error lint:*"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/internal/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/** @file
*
* Some of this config info may make more sense in a particular package. However
* due to the maxNodeModuleJsDepth hack and our general lax dependency graph,
* sometimes rational placements cause type resolution errors.
* due to https://github.com/Agoric/agoric-sdk/issues/4620 and our lax package
* dependency graph, sometimes rational placements cause type resolution errors.
*
* So as a work-around some constants that need access from more than one package are placed here.
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/notifier/src/asyncIterableAdaptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const makeAsyncIterableFromNotifier = notifierP => {
return harden({ value, done });
});
}
// xxx hint for type checker
assert(myIterationResultP);
return myIterationResultP;
},
});
Expand Down
3 changes: 2 additions & 1 deletion packages/notifier/src/storesub.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export const makeStoredSubscription = (
}

/** @type {StoredSubscription<T>} */
// @ts-expect-error getStoreKey invalid, deprecated type
// eslint-disable-next-line -- different per package https://github.com/Agoric/agoric-sdk/issues/4620
// @ts-ignore getStoreKey type does not have `subscription`
const storesub = Far('StoredSubscription', {
getStoreKey: async () => {
if (!storageNode) {
Expand Down
11 changes: 6 additions & 5 deletions packages/notifier/test/test-publish-kit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
/* eslint-disable @typescript-eslint/prefer-ts-expect-error -- https://github.com/Agoric/agoric-sdk/issues/4620 */

import { test } from './prepare-test-env-ava.js';
import {
Expand Down Expand Up @@ -124,13 +125,13 @@ test('makePublishKit', async t => {
'failure should not be allowed after finalization',
);
await t.throwsAsync(
// @ts-expect-error known to be promise version of PublicationList
// @ts-ignore known to be promise version of PublicationList
subFinal.tail,
undefined,
'tail promise of final result should be rejected',
);
await t.throwsAsync(
// @ts-expect-error known to be promise version of PublicationList
// @ts-ignore known to be promise version of PublicationList
subscriber.subscribeAfter(subFinal.publishCount),
undefined,
'subscribeAfter(finalPublishCount) should be rejected',
Expand Down Expand Up @@ -179,13 +180,13 @@ test('makePublishKit - immediate finish', async t => {
'failure should not be allowed after finalization',
);
await t.throwsAsync(
// @ts-expect-error known to be promise version of PublicationList
// @ts-ignore known to be promise version of PublicationList
subFinal.tail,
undefined,
'tail promise of final result should be rejected',
);
await t.throwsAsync(
// @ts-expect-error known to be promise version of PublicationList
// @ts-ignore known to be promise version of PublicationList
subscriber.subscribeAfter(subFinal.publishCount),
undefined,
'subscribeAfter(finalPublishCount) should be rejected',
Expand Down Expand Up @@ -336,7 +337,7 @@ test('subscribeAfter bounds checking', async t => {
const repr =
typeof badCount === 'string' ? JSON.stringify(badCount) : badCount;
t.throws(
// @ts-expect-error deliberate invalid arguments for testing
// @ts-ignore deliberate invalid arguments for testing
() => subscriber.subscribeAfter(badCount),
undefined,
`subscribeAfter should reject invalid publish count: ${typeof badCount} ${repr}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/pegasus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:eslint": "eslint .",
"lint:types": "tsc --maxNodeModuleJsDepth 4 -p jsconfig.json"
"lint:types": "tsc -p jsconfig.json"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/smart-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
"lint-fix": "yarn lint:eslint --fix",
"lint:types": "tsc --maxNodeModuleJsDepth 4 -p jsconfig.json",
"lint:types": "tsc -p jsconfig.json",
"lint:eslint": "eslint ."
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/store/src/patterns/interface-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export const defineHeapFarClassKit = (
const contextMapKit = objectMap(methodsKit, () => new WeakMap());
const prototypeKit = objectMap(methodsKit, (methods, facetName) =>
defendPrototype(
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- different per package #4620
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- different per package https://github.com/Agoric/agoric-sdk/issues/4620
// @ts-ignore could be symbol
`${tag} ${facetName}`,
contextMapKit[facetName],
Expand Down Expand Up @@ -394,7 +394,7 @@ export const defineHeapFarClassKit = (
}
return facets;
};
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- different per package #4620
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- different per package https://github.com/Agoric/agoric-sdk/issues/4620
// @ts-ignore xxx
return harden(makeInstanceKit);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lint-fix": "yarn lint:eslint --fix",
"lint": "run-s --continue-on-error lint:*",
"lint:eslint": "eslint .",
"lint:types": "tsc --maxNodeModuleJsDepth 3 -p jsconfig.json"
"lint:types": "tsc -p jsconfig.json"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
"lint-fix": "yarn lint:eslint --fix",
"lint:types": "tsc --maxNodeModuleJsDepth 3 -p jsconfig.json",
"lint:types": "tsc -p jsconfig.json",
"lint:eslint": "eslint ."
},
"devDependencies": {
Expand Down

0 comments on commit 4551371

Please sign in to comment.