Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript 5.6 #9795

Merged
merged 10 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@endo/eslint-plugin": "^2.2.1",
"@jessie.js/eslint-plugin": "^0.4.1",
"@types/express": "^4.17.17",
"@types/node": "^18.19.24",
"@types/node": "^22.0.0",
"ava": "^5.3.0",
"c8": "^9.1.0",
"conventional-changelog-conventionalcommits": "^4.6.0",
Expand All @@ -34,7 +34,7 @@
"type-coverage": "^2.27.1",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.1",
"typescript": "^5.5.3",
"typescript": "^5.6.2",
"typescript-eslint": "^7.15.0"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava",
"test:xs": "yarn test:xs-unit && yarn test:xs-worker",
Expand Down
9 changes: 7 additions & 2 deletions packages/SwingSet/misc-tools/replay-transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import { makeLocalVatManagerFactory } from '../src/kernel/vat-loader/manager-loc
import { makeSyscallSimulator } from '../src/kernel/vat-warehouse.js';
import { makeDummyMeterControl } from '../src/kernel/dummyMeterControl.js';

/**
* @import {SnapStore} from '@agoric/swing-store';
*/

const finished = promisify(finishedCallback);

// TODO: switch to full yargs for documenting output
Expand Down Expand Up @@ -213,7 +217,8 @@ async function replay(transcriptFile) {
let cleanupSnapStore;

if (argv.useCustomSnapStore) {
snapStore = /** @type {SnapStore} */ ({
snapStore = {
// @ts-expect-error missing methods and saveSnapshot return is missing field of SnapshotResult
async saveSnapshot(_vatID, snapPos, snapshotStream) {
const snapFile = `${vatID}-${snapPos}-${
saveSnapshotID || 'unknown'
Expand All @@ -238,7 +243,7 @@ async function replay(transcriptFile) {
const snapFile = `${vatID}-${loadSnapshotID}.xss`;
yield* fs.createReadStream(snapFile);
},
});
};
} else {
const tmpDb = tmpDirSync({
prefix: `ag-replay-${transcriptFile}`,
Expand Down
2 changes: 1 addition & 1 deletion packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 75.7
"atLeast": 75.81
}
}
2 changes: 1 addition & 1 deletion packages/SwingSet/src/kernel/deviceTranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function makeDRTranslator(deviceID, kernelKeeper) {
*
* @param {string} deviceID
* @param {string} deviceName
* @param {*} kernelKeeper
* @param {KernelKeeper} kernelKeeper
* @returns {(dsc: DeviceSyscallObject) => KernelSyscallObject}
*/
export function makeDSTranslator(deviceID, deviceName, kernelKeeper) {
Expand Down
5 changes: 2 additions & 3 deletions packages/SwingSet/src/kernel/gc-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function parseAction(s) {
}

/**
* @param {*} kernelKeeper
* @param {KernelKeeper} kernelKeeper
* @returns {import('../types-internal.js').RunQueueEvent | undefined}
*/
export function processGCActionSet(kernelKeeper) {
Expand Down Expand Up @@ -86,10 +86,9 @@ export function processGCActionSet(kernelKeeper) {
const hasCList = vatKeeper.hasCListEntry(kref);
const isReachable = hasCList ? vatKeeper.getReachableFlag(kref) : undefined;
const exists = kernelKeeper.kernelObjectExists(kref);
// @ts-expect-error xxx
const { reachable, recognizable } = exists
? kernelKeeper.getObjectRefCount(kref)
: {};
: { reachable: 0, recognizable: 0 };

if (type === 'dropExport') {
if (!exists) return false; // already, shouldn't happen
Expand Down
19 changes: 10 additions & 9 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ import { makeDeviceTranslators } from './deviceTranslator.js';
import { notifyTermination } from './notifyTermination.js';
import { makeVatAdminHooks } from './vat-admin-hooks.js';

/** @import * as liveslots from '@agoric/swingset-liveslots' */
/** @import {PolicyInputCleanupCounts} from '../types-external.js' */
/**
* @import {MeterConsumption, VatDeliveryObject, VatDeliveryResult, VatSyscallObject, VatSyscallResult} from '@agoric/swingset-liveslots';
* @import {PolicyInputCleanupCounts} from '../types-external.js';
*/

function abbreviateReplacer(_, arg) {
if (typeof arg === 'bigint') {
Expand All @@ -56,7 +58,7 @@ function abbreviateReplacer(_, arg) {
/**
* Provide the kref of a vat's root object, as if it had been exported.
*
* @param {*} kernelKeeper Kernel keeper managing persistent kernel state.
* @param {KernelKeeper} kernelKeeper Kernel keeper managing persistent kernel state.
* @param {string} vatID Vat ID of the vat whose root kref is sought.
*
* @returns {string} the kref of the root object of the given vat.
Expand Down Expand Up @@ -380,7 +382,6 @@ export default function buildKernel(

/**
*
* @typedef { import('@agoric/swingset-liveslots').MeterConsumption } MeterConsumption
* @typedef { import('../types-internal.js').MeterID } MeterID
* @typedef { import('../types-internal.js').Dirt } Dirt
*
Expand Down Expand Up @@ -416,7 +417,7 @@ export default function buildKernel(
*
* @param {VatID} vatID
* @param {KernelDeliveryObject} kd
* @param {liveslots.VatDeliveryObject} vd
* @param {VatDeliveryObject} vd
*/
async function deliverAndLogToVat(vatID, kd, vd) {
vatRequestedTermination = undefined;
Expand All @@ -426,7 +427,7 @@ export default function buildKernel(
const vs = kernelSlog.provideVatSlogger(vatID).vatSlog;
await null;
try {
/** @type { liveslots.VatDeliveryResult } */
/** @type { VatDeliveryResult } */
const deliveryResult = await vatWarehouse.deliverToVat(vatID, kd, vd, vs);
insistVatDeliveryResult(deliveryResult);
// const [ ok, problem, usage ] = deliveryResult;
Expand Down Expand Up @@ -1542,8 +1543,8 @@ export default function buildKernel(
// not
/**
*
* @param {liveslots.VatSyscallObject} vatSyscallObject
* @returns {liveslots.VatSyscallResult}
* @param {VatSyscallObject} vatSyscallObject
* @returns {VatSyscallResult}
*/
function vatSyscallHandler(vatSyscallObject) {
if (!vatWarehouse.lookup(vatID)) {
Expand All @@ -1558,7 +1559,7 @@ export default function buildKernel(
let ksc;
/** @type { KernelSyscallResult } */
let kres = harden(['error', 'incomplete']);
/** @type { liveslots.VatSyscallResult } */
/** @type { VatSyscallResult } */
let vres = harden(['error', 'incomplete']);

try {
Expand Down
4 changes: 4 additions & 0 deletions packages/SwingSet/src/kernel/state/kernelKeeper.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const CURRENT_SCHEMA_VERSION = 2;
// * change `version` to `'2'`
// * add `vats.terminated` with `[]` as initial value

/** @type {(s: string) => string[]} s */
export function commaSplit(s) {
if (s === '') {
return [];
Expand Down Expand Up @@ -804,6 +805,7 @@ export default function makeKernelKeeper(
p.decider = undefined;
}
p.policy = kvStore.get(`${kernelSlot}.policy`) || 'ignore';
// @ts-expect-error get() may fail
p.subscribers = commaSplit(kvStore.get(`${kernelSlot}.subscribers`));
p.queue = Array.from(
getPrefixedValues(kvStore, `${kernelSlot}.queue.`),
Expand All @@ -815,6 +817,7 @@ export default function makeKernelKeeper(
p.refCount = Number(kvStore.get(`${kernelSlot}.refCount`));
p.data = {
body: kvStore.get(`${kernelSlot}.data.body`),
// @ts-expect-error get() may fail
slots: commaSplit(kvStore.get(`${kernelSlot}.data.slots`)),
};
for (const s of p.data.slots) {
Expand Down Expand Up @@ -1981,3 +1984,4 @@ export default function makeKernelKeeper(
dump,
});
}
/** @typedef {ReturnType<typeof makeKernelKeeper>} KernelKeeper */
2 changes: 1 addition & 1 deletion packages/SwingSet/src/types-external.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export {};
*
* @typedef { { transcriptCount: number } } VatStats
* @typedef { ReturnType<typeof import('./kernel/state/vatKeeper.js').makeVatKeeper> } VatKeeper
* @typedef { ReturnType<typeof import('./kernel/state/kernelKeeper.js').default> } KernelKeeper
* @typedef { import('./kernel/state/kernelKeeper.js').KernelKeeper } KernelKeeper
* @typedef { Awaited<ReturnType<typeof import('@agoric/xsnap').xsnap>> } XSnap
* @typedef { (dr: VatDeliveryResult) => void } SlogFinishDelivery
* @typedef { (ksr: KernelSyscallResult, vsr: VatSyscallResult) => void } SlogFinishSyscall
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/gc-actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test('gc actions', t => {
}
const clistState = { v1: { ko1: {}, ko2: {} }, v2: { ko2: {} } };

/** @type {KernelKeeper} */
const kernelKeeper = {
getGCActions() {
return new Set(actions);
Expand All @@ -28,7 +29,9 @@ test('gc actions', t => {
const [reachable, recognizable] = rc[kref];
return { reachable, recognizable };
},
// @ts-expect-error mock
emitCrankHashes() {},
// @ts-expect-error mock
provideVatKeeper(vatID) {
return {
hasCListEntry(kref) {
Expand Down
4 changes: 2 additions & 2 deletions packages/async-flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down Expand Up @@ -61,6 +61,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 77.1
"atLeast": 77.29
}
}
2 changes: 1 addition & 1 deletion packages/base-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 90.03
"atLeast": 90.31
}
}
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:restart-vats-proposal": "echo This command has been deprecated. Please run this instead: agoric run scripts/vats/restart-vats.js",
"build:zcf-proposal": "echo This command has been deprecated. Please run this instead: agoric run scripts/vats/replace-zoe.js",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:xs": "exit 0",
"lint-fix": "yarn lint:eslint --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"demo": "node -e 'import(\"./test/fake-rpc-server.js\").then(ns => ns.develop())'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"rimraf": "^5.0.0",
"tsd": "^0.31.1",
"tsimp": "^2.0.11",
"typescript": "^5.5.3"
"typescript": "~5.6.2"
},
"dependencies": {
"@endo/base64": "^1.0.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"timeout": "20m"
},
"typeCoverage": {
"atLeast": 80.53
"atLeast": 80.55
}
}
2 changes: 1 addition & 1 deletion packages/governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "yarn build:bundles",
"build:bundles": "node ./scripts/build-bundles.js",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "yarn build:bundles",
"build:bundles": "node ./scripts/build-bundles.js",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down
4 changes: 2 additions & 2 deletions packages/internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:nyc": "exit 0",
"test:xs": "exit 0",
Expand Down Expand Up @@ -57,6 +57,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 93.32
"atLeast": 93.42
}
}
4 changes: 4 additions & 0 deletions packages/internal/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ export const synchronizedTee = (sourceStream, readerCount) => {
[Symbol.asyncIterator]() {
return reader;
},
// eslint-disable-next-line no-restricted-globals
async [Symbol.asyncDispose]() {
await reader.return();
},
});
return reader;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava",
"test:xs": "exit 0",
Expand Down
2 changes: 1 addition & 1 deletion packages/notifier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "exit 0",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down
4 changes: 2 additions & 2 deletions packages/orchestration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "exit 0",
"codegen": "scripts/fetch-chain-info.ts",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
"test:xs": "exit 0",
Expand Down Expand Up @@ -92,6 +92,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 97.57
"atLeast": 97.6
}
}
2 changes: 1 addition & 1 deletion packages/smart-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "yarn build:bundles",
"build:bundles": "node ./scripts/build-bundles.js",
"prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*'",
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'",
"test": "ava",
"test:xs": "exit 0",
"lint": "run-s --continue-on-error lint:*",
Expand Down
1 change: 0 additions & 1 deletion packages/smart-wallet/test/supports.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const subscriptionKey = subscription => {

/** @returns {import('@agoric/vats').BridgeManager} */
const makeFakeBridgeManager = () =>
// @ts-expect-error XXX generics puzzle: could be instantiated with a different subtype of constraint
Far('fakeBridgeManager', {
register(bridgeId, handler) {
return Far('scopedBridgeManager', {
Expand Down
2 changes: 1 addition & 1 deletion packages/solo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 73.4
"atLeast": 73.55
}
}
Loading
Loading