From 97c57c788445fa7d470489e663131fbfe30eb887 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 10:19:20 -0700 Subject: [PATCH 01/15] chore(deps): clean up unused --- packages/casting/package.json | 1 - packages/governance/package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/casting/package.json b/packages/casting/package.json index c8d7bda85ad..a2fad6b336f 100644 --- a/packages/casting/package.json +++ b/packages/casting/package.json @@ -24,7 +24,6 @@ "dependencies": { "@agoric/internal": "^0.3.2", "@agoric/notifier": "^0.6.2", - "@agoric/spawner": "^0.6.8", "@agoric/store": "^0.9.2", "@cosmjs/encoding": "^0.32.3", "@cosmjs/proto-signing": "^0.32.3", diff --git a/packages/governance/package.json b/packages/governance/package.json index c362627a95b..26c0c8d1c0f 100644 --- a/packages/governance/package.json +++ b/packages/governance/package.json @@ -34,7 +34,6 @@ "@agoric/assert": "^0.6.0", "@agoric/ertp": "^0.16.2", "@agoric/internal": "^0.3.2", - "@agoric/network": "^0.1.0", "@agoric/notifier": "^0.6.2", "@agoric/store": "^0.9.2", "@agoric/time": "^0.3.2", From 416818bf8ab0d7776f203e18f26629442eb26107 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 15 May 2024 12:20:06 -0700 Subject: [PATCH 02/15] fix(types): include .cjs --- packages/xsnap/package.json | 2 +- packages/xsnap/src/avaHandler.cjs | 3 --- packages/xsnap/tsconfig.json | 9 ++++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/xsnap/package.json b/packages/xsnap/package.json index 677aef20318..ab4b4bb2d2d 100644 --- a/packages/xsnap/package.json +++ b/packages/xsnap/package.json @@ -74,6 +74,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 94.44 + "atLeast": 94.04 } } diff --git a/packages/xsnap/src/avaHandler.cjs b/packages/xsnap/src/avaHandler.cjs index 5dc8099dfcd..8aaba660368 100644 --- a/packages/xsnap/src/avaHandler.cjs +++ b/packages/xsnap/src/avaHandler.cjs @@ -12,7 +12,6 @@ HandledPromise is defined by eventual send shim. /// /// -// @ts-expect-error cannot redeclare encoder const encoder = new TextEncoder(); const decoder = new TextDecoder(); @@ -33,7 +32,6 @@ function send(item) { */ const bundleSource = async (startFilename, ...args) => { const msg = await send({ bundleSource: [startFilename, ...args] }); - // @ts-expect-error send() returns void return JSON.parse(decoder.decode(msg)); }; @@ -87,7 +85,6 @@ function handler(rawMessage) { __filename, console, assert, - // @ts-expect-error HandledPromise, URL: class URLStub { constructor(url, base) { diff --git a/packages/xsnap/tsconfig.json b/packages/xsnap/tsconfig.json index 88ee89a10d6..33a8212f172 100644 --- a/packages/xsnap/tsconfig.json +++ b/packages/xsnap/tsconfig.json @@ -6,10 +6,9 @@ }, "include": [ "*.js", - "lib/**/*.js", - "src/**/*.d.ts", - "src/**/*.js", - "test/**/*.js", - "tools/**/*.js", + "lib", + "src", + "test", + "tools", ], } From b02c0048c467f7f788da97dc28415afb2bbe1806 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 16:03:17 -0700 Subject: [PATCH 03/15] test: conform to time type --- packages/inter-protocol/test/auction/scheduleMath.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/inter-protocol/test/auction/scheduleMath.test.js b/packages/inter-protocol/test/auction/scheduleMath.test.js index 96b3a35f225..18c6e673607 100644 --- a/packages/inter-protocol/test/auction/scheduleMath.test.js +++ b/packages/inter-protocol/test/auction/scheduleMath.test.js @@ -211,8 +211,8 @@ const TWO_PM = 1680876000n; const FIVE_MINUTES = 5n * 60n; const FIFTEEN_MINUTES = 15n * 60n; const defaults = /** @type {any} */ (makeDefaultParams()); -const TWO_PM_SCHED = computeRoundTiming(defaults, TWO_PM - 1n); -const THREE_PM_SCHED = computeRoundTiming(defaults, TWO_PM); +const TWO_PM_SCHED = computeRoundTiming(defaults, coerceAbs(TWO_PM - 1n)); +const THREE_PM_SCHED = computeRoundTiming(defaults, coerceAbs(TWO_PM)); const checkDescendingStep = (t, liveSchedule, nextSchedule, now, expected) => { const nowTime = coerceAbs(now); From 0985eeb0dba06031f01fa35648299ad8dc883b5c Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 16:23:34 -0700 Subject: [PATCH 04/15] chore: rm empty types module --- packages/SwingSet/src/vats/timer/types.js | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 packages/SwingSet/src/vats/timer/types.js diff --git a/packages/SwingSet/src/vats/timer/types.js b/packages/SwingSet/src/vats/timer/types.js deleted file mode 100644 index cda223f55aa..00000000000 --- a/packages/SwingSet/src/vats/timer/types.js +++ /dev/null @@ -1,2 +0,0 @@ -// Empty JS file to correspond with types.d.ts -export {}; From 41460f5055c79c12f40647adc99c2dc1554030e5 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 17:23:38 -0700 Subject: [PATCH 05/15] chore: update type-coverage --- packages/base-zone/package.json | 2 +- packages/boot/package.json | 2 +- packages/builders/package.json | 2 +- packages/inter-protocol/package.json | 2 +- packages/network/package.json | 2 +- packages/orchestration/package.json | 2 +- packages/smart-wallet/package.json | 2 +- packages/vat-data/package.json | 2 +- packages/vats/package.json | 2 +- packages/vow/package.json | 2 +- packages/zone/package.json | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/base-zone/package.json b/packages/base-zone/package.json index c3d6be73309..8a80494b9d8 100644 --- a/packages/base-zone/package.json +++ b/packages/base-zone/package.json @@ -57,6 +57,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 89.87 + "atLeast": 90.77 } } diff --git a/packages/boot/package.json b/packages/boot/package.json index a26df469ead..df4561213ea 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -91,6 +91,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 86.47 + "atLeast": 86.79 } } diff --git a/packages/builders/package.json b/packages/builders/package.json index b4d32881833..6b4544c6db3 100644 --- a/packages/builders/package.json +++ b/packages/builders/package.json @@ -79,6 +79,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 74.28 + "atLeast": 74.23 } } diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index 80a4f529a30..fb0a0077c26 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -84,6 +84,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 95.86 + "atLeast": 95.87 } } diff --git a/packages/network/package.json b/packages/network/package.json index c405a07e7d9..ae15fedcb3b 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -70,6 +70,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 89.5 + "atLeast": 89.39 } } diff --git a/packages/orchestration/package.json b/packages/orchestration/package.json index 9fae85e4378..f8daacf2d4b 100644 --- a/packages/orchestration/package.json +++ b/packages/orchestration/package.json @@ -83,6 +83,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 96.18 + "atLeast": 97.25 } } diff --git a/packages/smart-wallet/package.json b/packages/smart-wallet/package.json index 0d67b05048b..18572590735 100644 --- a/packages/smart-wallet/package.json +++ b/packages/smart-wallet/package.json @@ -69,6 +69,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 94.36 + "atLeast": 94.4 } } diff --git a/packages/vat-data/package.json b/packages/vat-data/package.json index db8821266ed..48939984a54 100644 --- a/packages/vat-data/package.json +++ b/packages/vat-data/package.json @@ -50,6 +50,6 @@ "node": "^18.12 || ^20.9" }, "typeCoverage": { - "atLeast": 98.74 + "atLeast": 99.06 } } diff --git a/packages/vats/package.json b/packages/vats/package.json index bc8ee102541..9ddfe6dcb36 100644 --- a/packages/vats/package.json +++ b/packages/vats/package.json @@ -79,6 +79,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 91.33 + "atLeast": 91.24 } } diff --git a/packages/vow/package.json b/packages/vow/package.json index 302233ad4bd..890c2eafd66 100755 --- a/packages/vow/package.json +++ b/packages/vow/package.json @@ -52,6 +52,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 89.38 + "atLeast": 89.34 } } diff --git a/packages/zone/package.json b/packages/zone/package.json index 97e5c8f28e2..779846034fd 100644 --- a/packages/zone/package.json +++ b/packages/zone/package.json @@ -55,6 +55,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 96.66 + "atLeast": 96.68 } } From 5140008411df99b2a49baf42ca25d830df780d8e Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 15 May 2024 09:14:16 -0700 Subject: [PATCH 06/15] chore(types): more explicit imports to fix build order sensitivity --- packages/inter-protocol/src/proposals/econ-behaviors.js | 3 --- packages/vats/src/types.d.ts | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/inter-protocol/src/proposals/econ-behaviors.js b/packages/inter-protocol/src/proposals/econ-behaviors.js index c3fbff712bd..2475fcf0d19 100644 --- a/packages/inter-protocol/src/proposals/econ-behaviors.js +++ b/packages/inter-protocol/src/proposals/econ-behaviors.js @@ -1,8 +1,5 @@ // @jessie-check -// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/vats/src/core/types-ambient.js'; - import { AmountMath } from '@agoric/ertp'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; diff --git a/packages/vats/src/types.d.ts b/packages/vats/src/types.d.ts index 081567ee76f..fceaf158f36 100644 --- a/packages/vats/src/types.d.ts +++ b/packages/vats/src/types.d.ts @@ -1,4 +1,5 @@ import type { Guarded } from '@endo/exo'; +import type { ERef } from '@endo/far'; export type Board = ReturnType< ReturnType From 85fb5ac1157d727f0757a8dc2ef36e3f797c5c75 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 15 May 2024 11:17:33 -0700 Subject: [PATCH 07/15] chore(types): simplify StartFunction tagging Helps avoid exporting private type --- packages/zoe/src/zoeService/utils.d.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/zoe/src/zoeService/utils.d.ts b/packages/zoe/src/zoeService/utils.d.ts index f94b6762d98..2275a21c3ff 100644 --- a/packages/zoe/src/zoeService/utils.d.ts +++ b/packages/zoe/src/zoeService/utils.d.ts @@ -1,5 +1,5 @@ import type { Issuer } from '@agoric/ertp/exported.js'; -import type { Tagged } from '@agoric/internal/src/tagged.js'; +import type { TagContainer } from '@agoric/internal/src/tagged.js'; import type { Callable } from '@agoric/internal/src/utils.js'; import type { Baggage } from '@agoric/swingset-liveslots'; import type { VatUpgradeResults } from '@agoric/swingset-vat'; @@ -16,17 +16,14 @@ type ContractFacet = { * Installation of a contract, typed by its start function. */ export type Installation = - RemotableObject & - Tagged< - { - getBundle: () => SourceBundle; - getBundleLabel: () => string; - }, - 'StartFunction', - SF - >; + TagContainer & + RemotableObject & { + getBundle: () => SourceBundle; + getBundleLabel: () => string; + }; + export type Instance = - RemotableObject & Tagged, 'StartFunction', SF>; + TagContainer & RemotableObject & Handle<'Instance'>; export type InstallationStart = I extends Installation ? SF : never; From caad41f9891a9b2a1194f5567803e40dd54f1169 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 15:14:43 -0700 Subject: [PATCH 08/15] refactor(types): @import --- packages/time/src/timeMath.js | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/time/src/timeMath.js b/packages/time/src/timeMath.js index d11edd057d8..baa541b8f90 100644 --- a/packages/time/src/timeMath.js +++ b/packages/time/src/timeMath.js @@ -2,14 +2,16 @@ import { Nat } from '@endo/nat'; import { mustMatch } from '@endo/patterns'; import { RelativeTimeRecordShape, TimestampRecordShape } from './typeGuards.js'; +/** @import {RelativeTime, RelativeTimeValue, TimerBrand, TimeMathType, Timestamp, TimestampRecord, TimestampValue} from './types.js' */ + const { Fail, quote: q } = assert; /** * `agreedTimerBrand` is internal to this module. * - * @param {import('./types').TimerBrand | undefined} leftBrand - * @param {import('./types').TimerBrand | undefined} rightBrand - * @returns {import('./types').TimerBrand | undefined} + * @param {TimerBrand | undefined} leftBrand + * @param {TimerBrand | undefined} rightBrand + * @returns {TimerBrand | undefined} */ const agreedTimerBrand = (leftBrand, rightBrand) => { if (leftBrand === undefined) { @@ -34,9 +36,9 @@ const agreedTimerBrand = (leftBrand, rightBrand) => { * this logic. It does the error checking between the operands, and returns * the brand, if any, that should label the resulting time value. * - * @param {import('./types').Timestamp | import('./types').RelativeTime} left - * @param {import('./types').Timestamp | import('./types').RelativeTime} right - * @returns {import('./types').TimerBrand | undefined} + * @param {Timestamp | RelativeTime} left + * @param {Timestamp | RelativeTime} right + * @returns {TimerBrand | undefined} */ const sharedTimerBrand = (left, right) => { const leftBrand = typeof left === 'bigint' ? undefined : left.timerBrand; @@ -49,10 +51,10 @@ const sharedTimerBrand = (left, right) => { * operators in the case where the returned time should be a `Timestamp` * rather than a `RelativeTime`. * - * @param {import('./types').Timestamp | import('./types').RelativeTime} left - * @param {import('./types').Timestamp | import('./types').RelativeTime} right - * @param {import('./types').TimestampValue} absValue - * @returns {import('./types').Timestamp} + * @param {Timestamp | RelativeTime} left + * @param {Timestamp | RelativeTime} right + * @param {TimestampValue} absValue + * @returns {Timestamp} */ const absLike = (left, right, absValue) => { Nat(absValue); @@ -72,10 +74,10 @@ const absLike = (left, right, absValue) => { * operators in the case where the returned time should be a `RelativeTime` * rather than a `Timestamp`. * - * @param {import('./types').Timestamp | import('./types').RelativeTime} left - * @param {import('./types').Timestamp | import('./types').RelativeTime} right - * @param {import('./types').RelativeTimeValue} relValue - * @returns {import('./types').RelativeTime} + * @param {Timestamp | RelativeTime} left + * @param {Timestamp | RelativeTime} right + * @param {RelativeTimeValue} relValue + * @returns {RelativeTime} */ const relLike = (left, right, relValue) => { Nat(relValue); @@ -187,8 +189,8 @@ const modRelRel = (rel, step) => * `compareValues` is internal to this module, and used to implement * the time comparison operators. * - * @param {import('./types').Timestamp | import('./types').RelativeTime} left - * @param {import('./types').Timestamp | import('./types').RelativeTime} right + * @param {Timestamp | RelativeTime} left + * @param {Timestamp | RelativeTime} right * @param {bigint} v1 * @param {bigint} v2 * @returns {import('@endo/marshal').RankComparison} @@ -237,7 +239,7 @@ const compareValues = (left, right, v1, v2) => { * operand, and return a labeled time object with the brand of the labeled * operand. * - * @type {import('./types').TimeMathType} + * @type {TimeMathType} */ export const TimeMath = harden({ absValue, From b269707c32e58d3a1e344598a7539a2a122eeaa7 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 15:25:11 -0700 Subject: [PATCH 09/15] docs: use of .d.ts files --- docs/typescript.md | 46 +++++++++++++++++++++++++++++++++++++++++++--- tsconfig.json | 2 ++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/docs/typescript.md b/docs/typescript.md index 7e5aa98114e..1fa33c587fa 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -4,10 +4,53 @@ Our use of TypeScript has to accomodate both .js development in agoric-sdk (whic ## Best practices +- `.d.ts` for types modules - package entrypoint(s) exports explicit types - for packages upon which other packages expect ambient types: - `exported.js` exports the explicit types and ambient re-exports +## .d.ts modules + +We cannot use `.ts` files any modules that are transitively imported into an Endo bundle. The reason is that the Endo bundler doesn't understand `.ts` syntax and we don't want it to until we have sufficient auditability of the transformation. Moreover we've tried to avoid a build step in order to import a module. (The one exception so far is `@agoric/cosmic-proto` because we codegen the types. Those modules are written in `.ts` syntax and build to `.js` by a build step that creates `dist`, which is the package export.) + +A `.d.ts` module allows defining the type in `.ts` syntax, without any risk that it will be included in runtime code. The `.js` is what actually gets imported. + +The are some consequences to this approach. + +### File pair + +You have to create a `.js` and `.d.ts` pair for each module. Usually it's of the form, + +```js +// Empty JS file to correspond with its .d.ts twin +export {}; +``` + +### Lack of type checking + +We have `"skipLibCheck": true"` in the root tsconfig.json because some libraries we depend on have their own type errors. (A massive one is the output of Telescope, used in `@agoric/cosmic-proto`.) + +This means that the types you write in `.d.ts` file won't be checked by `tsc`. To gain some confidence, you can temporarily flip that setting in a package's own `tsconfig.json` and pay attention to only the relevant errors. + +### Alternatives + +We've experimented with having `.ts` files. It works, and gets around the skipLibCheck problem, but it complicates the build and exports. It also necessitates a build step even in package that don't currently need it. + +## entrypoint + +This is usually an `index.js` file which contains a wildcard export like, + +```js +// eslint-disable-next-line import/export -- just types +export * from './src/types.js'; +``` + +The `types.js` file either defines the types itself or is an empty file (described above) paired with a `.d.ts` or `.ts` twin. + +One option considered is having the conditional package `"exports"` include `"types"` but that has to be a .d.ts file. That could be generated from a `.ts` but it would require a build step, which we've so far avoided. + +Once we have [JSDoc export type support](https://github.com/microsoft/TypeScript/issues/48104) we'll be able instead to keep the `index.js` entrypoint and have it export the types from `.ts` files without a runtime import of the module containing them. + ## exported.js The `exported.js` re-exports types into global namespace, for consumers that expect these to @@ -15,7 +58,6 @@ be ambient. This could be called "ambient.js" but we retain the filename for bac The pattern is to make these two files like this at package root: - `exported.js` ```ts @@ -44,7 +86,6 @@ Why the _ prefix? Because without it TS gets confused between the import and export symbols. ([h/t](https://stackoverflow.com/a/66588974)) Note one downside vs ambients is that these types will appear to be on `globalThis`. - ## Generating API docs We use [TypeDoc](https://typedoc.org/) to render API docs in HTML. @@ -53,4 +94,3 @@ We use [TypeDoc](https://typedoc.org/) to render API docs in HTML. yarn docs open api-docs/index.html ``` - diff --git a/tsconfig.json b/tsconfig.json index e07a194b3e1..247fab83052 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,8 @@ "target": "esnext", "module": "esnext", "moduleResolution": "bundler", + // This prevents checking of .d.ts files. We would like to check the ones we write + // but we leave this off because of the errors in deps we don't control. "skipLibCheck": true, "allowJs": true, "checkJs": true, From 6a6e59549e7beeeef94bf90556ed16873c46d285 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 15:08:26 -0700 Subject: [PATCH 10/15] fix(types): problems hidden by skipLibCheck --- packages/deploy-script-support/src/helpers.js | 1 - .../src/auction/scheduleMath.js | 6 +++-- packages/smart-wallet/src/types.d.ts | 6 +---- packages/store/exported.d.ts | 1 - .../swingset-liveslots/src/vatDataTypes.d.ts | 27 ++++++++++++------- packages/time/src/timeMath.js | 2 ++ packages/time/src/types.d.ts | 16 ++++++----- packages/vat-data/src/exo-utils.js | 2 +- packages/vats/src/types.d.ts | 12 +++++---- 9 files changed, 41 insertions(+), 32 deletions(-) diff --git a/packages/deploy-script-support/src/helpers.js b/packages/deploy-script-support/src/helpers.js index 1f676047e91..a2fb0617a82 100644 --- a/packages/deploy-script-support/src/helpers.js +++ b/packages/deploy-script-support/src/helpers.js @@ -1,6 +1,5 @@ // @ts-check -/// /// import { E } from '@endo/far'; diff --git a/packages/inter-protocol/src/auction/scheduleMath.js b/packages/inter-protocol/src/auction/scheduleMath.js index 85a00fb0ee0..969981ea418 100644 --- a/packages/inter-protocol/src/auction/scheduleMath.js +++ b/packages/inter-protocol/src/auction/scheduleMath.js @@ -4,6 +4,8 @@ import { TimeMath } from '@agoric/time'; import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; import { assertAllDefined, makeTracer } from '@agoric/internal'; +/** @import {TimestampRecord} from '@agoric/time'; */ + const { subtract, multiply, floorDivide } = natSafeMath; const { Fail } = assert; @@ -35,7 +37,7 @@ const subtract1 = relTime => * their collateral). * * @param {Awaited} params - * @param {Timestamp} baseTime + * @param {TimestampRecord} baseTime * @returns {import('./scheduler.js').Schedule} */ export const computeRoundTiming = (params, baseTime) => { @@ -83,7 +85,7 @@ export const computeRoundTiming = (params, baseTime) => { // computed start is `startDelay + baseTime + freq - (baseTime mod freq)`. // That is, if there are hourly starts, we add an hour to the time, and // subtract baseTime mod freq. Then we add the delay. - /** @type {import('@agoric/time').TimestampRecord} */ + /** @type {TimestampRecord} */ const startTime = TimeMath.addAbsRel( TimeMath.addAbsRel( baseTime, diff --git a/packages/smart-wallet/src/types.d.ts b/packages/smart-wallet/src/types.d.ts index fbce32281a6..54ad2a8cb0d 100644 --- a/packages/smart-wallet/src/types.d.ts +++ b/packages/smart-wallet/src/types.d.ts @@ -34,10 +34,6 @@ export type Cell = { set(val: T): void; }; -export type BridgeActionCapData = WalletCapData< - import('./smartWallet.js').BridgeAction ->; - /** * Defined by walletAction struct in msg_server.go * @@ -47,7 +43,7 @@ export type WalletActionMsg = { type: 'WALLET_ACTION'; /** base64 of Uint8Array of bech32 data */ owner: string; - /** JSON of BridgeActionCapData */ + /** JSON of marshalled BridgeAction */ action: string; blockHeight: unknown; // int64 blockTime: unknown; // int64 diff --git a/packages/store/exported.d.ts b/packages/store/exported.d.ts index 09575b61327..800f1a2c54a 100644 --- a/packages/store/exported.d.ts +++ b/packages/store/exported.d.ts @@ -13,7 +13,6 @@ import { import { Pattern as _Pattern } from '@endo/patterns'; declare global { export { - _LegacyMap as LegacyMap, _LegacyMap as LegacyMap, _LegacyWeakMap as LegacyWeakMap, _MapStore as MapStore, diff --git a/packages/swingset-liveslots/src/vatDataTypes.d.ts b/packages/swingset-liveslots/src/vatDataTypes.d.ts index b1af421557d..2e822b3a912 100644 --- a/packages/swingset-liveslots/src/vatDataTypes.d.ts +++ b/packages/swingset-liveslots/src/vatDataTypes.d.ts @@ -12,7 +12,7 @@ import type { WeakMapStore, WeakSetStore, } from '@agoric/store'; -import type { StateShape } from '@endo/exo'; +import type { Amplify, IsInstance, ReceivePower, StateShape } from '@endo/exo'; import type { RemotableObject } from '@endo/pass-style'; import type { InterfaceGuard, Pattern } from '@endo/patterns'; import type { makeWatchedPromiseManager } from './watchedPromises.js'; @@ -49,8 +49,15 @@ export type KindFacets = { export type KindContext = { state: S; self: KindFacet }; export type MultiKindContext = { state: S; facets: KindFacets }; -export type PlusContext = (c: C, ...args: Parameters) => ReturnType; -export type FunctionsPlusContext = { +export type PlusContext any> = ( + c: C, + ...args: Parameters +) => ReturnType; + +export type FunctionsPlusContext< + C, + O extends Record any>, +> = { [K in keyof O]: PlusContext; }; @@ -88,7 +95,7 @@ export type DefineKindOptions = { * this class kit as an argument, in which case it will return the facets * record, giving access to all the facet instances of the same cohort. */ - receiveAmplifier?: ReceivePower>; + receiveAmplifier?: ReceivePower; /** * If a `receiveInstanceTester` function is provided, it will be called @@ -169,7 +176,7 @@ export type DefineKindOptions = { export type VatData = { // virtual kinds /** @deprecated Use defineVirtualExoClass instead */ - defineKind: ( + defineKind:

, S, F>( tag: string, init: (...args: P) => S, facet: F, @@ -177,7 +184,7 @@ export type VatData = { ) => (...args: P) => KindFacet; /** @deprecated Use defineVirtualExoClassKit instead */ - defineKindMulti: ( + defineKindMulti:

, S, B>( tag: string, init: (...args: P) => S, behavior: B, @@ -188,7 +195,7 @@ export type VatData = { makeKindHandle: (descriptionTag: string) => DurableKindHandle; /** @deprecated Use defineDurableExoClass instead */ - defineDurableKind: ( + defineDurableKind:

, S, F>( kindHandle: DurableKindHandle, init: (...args: P) => S, facet: F, @@ -196,7 +203,7 @@ export type VatData = { ) => (...args: P) => KindFacet; /** @deprecated Use defineDurableExoClassKit instead */ - defineDurableKindMulti: ( + defineDurableKindMulti:

, S, B>( kindHandle: DurableKindHandle, init: (...args: P) => S, behavior: B, @@ -246,7 +253,7 @@ export interface PickFacet { } /** @deprecated Use prepareExoClass instead */ -export type PrepareKind = ( +export type PrepareKind =

, S, F>( baggage: Baggage, tag: string, init: (...args: P) => S, @@ -255,7 +262,7 @@ export type PrepareKind = ( ) => (...args: P) => KindFacet; /** @deprecated Use prepareExoClassKit instead */ -export type PrepareKindMulti = ( +export type PrepareKindMulti =

, S, B>( baggage: Baggage, tag: string, init: (...args: P) => S, diff --git a/packages/time/src/timeMath.js b/packages/time/src/timeMath.js index baa541b8f90..242246609d3 100644 --- a/packages/time/src/timeMath.js +++ b/packages/time/src/timeMath.js @@ -246,7 +246,9 @@ export const TimeMath = harden({ relValue, coerceTimestampRecord, coerceRelativeTimeRecord, + // @ts-expect-error xxx dynamic typing addAbsRel, + // @ts-expect-error xxx dynamic typing addRelRel, subtractAbsAbs, clampedSubtractAbsAbs, diff --git a/packages/time/src/types.d.ts b/packages/time/src/types.d.ts index d305ae4744e..007f66c5939 100644 --- a/packages/time/src/types.d.ts +++ b/packages/time/src/types.d.ts @@ -167,7 +167,7 @@ export interface TimerServiceI { delay: RelativeTime, interval: RelativeTime, cancelToken?: CancelToken, - ) => Notifier; + ) => import('@agoric/notifier').Notifier; /** * Cancel a previously-established wakeup or repeater. */ @@ -290,17 +290,19 @@ export type TimeMathType = { ) => RelativeTimeRecord; /** * An absolute time + a relative time gives a new absolute time. - * - * @template {Timestamp} T */ - addAbsRel: (abs: T, rel: RelativeTime) => T; + addAbsRel: ( + abs: T, + rel: RelativeTime, + ) => T extends TimestampRecord ? TimestampRecord : TimestampValue; /** * A relative time (i.e., a duration) + another relative time * gives a new relative time. - * - * @template {RelativeTime} T */ - addRelRel: (rel1: T, rel2: T) => T; + addRelRel: ( + rel1: T, + rel2: T, + ) => T extends RelativeTimeRecord ? RelativeTimeRecord : RelativeTimeValue; /** * The difference between two absolute times is a relative time. If abs1 > abs2 * the difference would be negative, so this method throws instead. diff --git a/packages/vat-data/src/exo-utils.js b/packages/vat-data/src/exo-utils.js index 4c52bf180a7..a6f507ab28a 100644 --- a/packages/vat-data/src/exo-utils.js +++ b/packages/vat-data/src/exo-utils.js @@ -14,7 +14,7 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js'; * Make a version of the argument function that takes a kind context but * ignores it. * - * @type {(fn: T) => import('@agoric/swingset-liveslots').PlusContext} + * @type { any>(fn: T) => import('@agoric/swingset-liveslots').PlusContext} */ export const ignoreContext = fn => diff --git a/packages/vats/src/types.d.ts b/packages/vats/src/types.d.ts index fceaf158f36..f91b4ae577e 100644 --- a/packages/vats/src/types.d.ts +++ b/packages/vats/src/types.d.ts @@ -1,3 +1,5 @@ +import type { Bytes } from '@agoric/network'; +import type { PromiseVow } from '@agoric/vow'; import type { Guarded } from '@endo/exo'; import type { ERef } from '@endo/far'; @@ -42,13 +44,13 @@ export type NameAdmin = { */ default: (key: string, newValue: T, newAdmin?: NameAdmin) => T; /** Update only if already initialized. Reject if not. */ - set: (key: string, newValue: V, newAdmin?: NameAdmin) => void; + set: (key: string, newValue: any, newAdmin?: NameAdmin) => void; /** * Fulfill an outstanding reserved promise (if any) to the newValue and set * the key to the newValue. If newAdmin is provided, set that to return via * lookupAdmin. */ - update: (key: string, newValue: V, newAdmin?: NameAdmin) => void; + update: (key: string, newValue: any, newAdmin?: NameAdmin) => void; /** * Look up the `newAdmin` from the path of keys starting from the current * NameAdmin. Wait on any reserved promises. @@ -62,7 +64,7 @@ export type NameAdmin = { }; export type NameHubUpdateHandler = { - write: (entries: [string, V][]) => void; + write: (entries: [string, any][]) => void; }; /** a node in a name hierarchy */ @@ -142,7 +144,7 @@ export type ConnectingInfo = { }; /** see [ibc_module.go](../../../golang/cosmos/x/vibc/types/ibc_module.go) */ -type IBCBridgeEvent = +export type IBCBridgeEvent = | 'channelOpenInit' | 'channelOpenTry' | 'channelOpenAck' @@ -185,7 +187,7 @@ export type IBCEvent = { }; /** see [receiver.go](../../../golang/cosmos/x/vibc/types/receiver.go) */ -type IBCDowncallMethod = +export type IBCDowncallMethod = | 'sendPacket' | 'tryOpenExecuted' | 'receiveExecuted' From d371cb377035e1f7a44f5abfe851be080a869ad8 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 13 May 2024 17:26:53 -0700 Subject: [PATCH 11/15] chore: update type-coverage --- packages/SwingSet/package.json | 2 +- packages/boot/package.json | 2 +- packages/inter-protocol/package.json | 2 +- packages/pegasus/package.json | 2 +- packages/smart-wallet/package.json | 2 +- packages/swingset-liveslots/package.json | 2 +- packages/time/package.json | 2 +- packages/vat-data/package.json | 2 +- packages/vats/package.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/SwingSet/package.json b/packages/SwingSet/package.json index 12fb6bf72ad..26cc89457d0 100644 --- a/packages/SwingSet/package.json +++ b/packages/SwingSet/package.json @@ -101,6 +101,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 74.99 + "atLeast": 75.02 } } diff --git a/packages/boot/package.json b/packages/boot/package.json index df4561213ea..d442d4fe694 100644 --- a/packages/boot/package.json +++ b/packages/boot/package.json @@ -91,6 +91,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 86.79 + "atLeast": 86.74 } } diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index fb0a0077c26..80a4f529a30 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -84,6 +84,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 95.87 + "atLeast": 95.86 } } diff --git a/packages/pegasus/package.json b/packages/pegasus/package.json index 8c7e9743675..9c08eec73cc 100644 --- a/packages/pegasus/package.json +++ b/packages/pegasus/package.json @@ -72,6 +72,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 90.68 + "atLeast": 90.61 } } diff --git a/packages/smart-wallet/package.json b/packages/smart-wallet/package.json index 18572590735..c836cd919f8 100644 --- a/packages/smart-wallet/package.json +++ b/packages/smart-wallet/package.json @@ -69,6 +69,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 94.4 + "atLeast": 94.35 } } diff --git a/packages/swingset-liveslots/package.json b/packages/swingset-liveslots/package.json index 93d12406127..ce951158aa3 100644 --- a/packages/swingset-liveslots/package.json +++ b/packages/swingset-liveslots/package.json @@ -68,6 +68,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 75.24 + "atLeast": 75.29 } } diff --git a/packages/time/package.json b/packages/time/package.json index 34f9ef8224d..08dfc863a76 100644 --- a/packages/time/package.json +++ b/packages/time/package.json @@ -58,6 +58,6 @@ "access": "public" }, "typeCoverage": { - "atLeast": 87.11 + "atLeast": 87.29 } } diff --git a/packages/vat-data/package.json b/packages/vat-data/package.json index 48939984a54..48dc8ef8623 100644 --- a/packages/vat-data/package.json +++ b/packages/vat-data/package.json @@ -50,6 +50,6 @@ "node": "^18.12 || ^20.9" }, "typeCoverage": { - "atLeast": 99.06 + "atLeast": 99.33 } } diff --git a/packages/vats/package.json b/packages/vats/package.json index 9ddfe6dcb36..eaf24a0edba 100644 --- a/packages/vats/package.json +++ b/packages/vats/package.json @@ -79,6 +79,6 @@ "workerThreads": false }, "typeCoverage": { - "atLeast": 91.24 + "atLeast": 91.25 } } From 73a1c116801c9b72235f3ad17fecc93a49ba0789 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 16 May 2024 09:34:11 -0700 Subject: [PATCH 12/15] ci: test prepack ordering --- .github/workflows/test-all-packages.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 29c1b529d3f..e0121710068 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -62,8 +62,11 @@ jobs: # attempting to merge to master. This takes about 1min locally and since # this job is about 30s in CI doing it here doesn't add to wall wait # for CI resolution. + # We prepack only because full pack removes the declarations, relying on ambient + # resolution in the repo filesystem which will not be available when the packages + # are pulled from npm. - name: Pack packages - run: yarn lerna exec --reject-cycles --concurrency 1 "npm pack" + run: yarn lerna run --reject-cycles --concurrency 1 prepack ################## # Lint tests From f39d40f7d403f7e1cbd625db8fa5acb6202459fe Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 16 May 2024 09:49:19 -0700 Subject: [PATCH 13/15] chore: export `modules` map for its type export --- packages/vats/src/core/boot-chain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vats/src/core/boot-chain.js b/packages/vats/src/core/boot-chain.js index 40b3fcb5743..e6784893711 100644 --- a/packages/vats/src/core/boot-chain.js +++ b/packages/vats/src/core/boot-chain.js @@ -13,7 +13,7 @@ const { } = chainBehaviorsPlus; const behaviors = { ...basicBehaviors, ...chainBehaviors }; -const modules = { +export const modules = { behaviors: { ...behaviors }, utils: { ...utils }, }; From b2306a81fcf9a2954abfae6fdf8b8cc6ce754399 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 16 May 2024 10:02:14 -0700 Subject: [PATCH 14/15] style: consistent spacing of triple-slash --- packages/ERTP/src/types.js | 2 +- packages/agoric-cli/src/publish.js | 2 +- packages/assert/src/types-ambient.js | 2 +- packages/casting/src/follower-cosmjs.js | 2 +- packages/inter-protocol/test/psm/gov-replace-committee.js | 2 +- packages/internal/src/index.js | 2 +- packages/notifier/src/asyncIterableAdaptor.js | 2 +- packages/notifier/src/notifier.js | 2 +- packages/notifier/src/publish-kit.js | 2 +- packages/notifier/src/subscriber.js | 2 +- packages/pegasus/src/types.js | 2 +- packages/store/src/types.js | 2 +- packages/time/src/types.d.ts | 2 +- packages/vat-data/src/index.js | 2 +- packages/vats/src/core/core-eval-env.d.ts | 5 +++-- packages/xsnap-lockdown/lib/ses-boot-debug.js | 2 +- packages/xsnap-lockdown/lib/ses-boot.js | 2 +- packages/zoe/src/contractSupport/types-ambient.js | 2 +- packages/zoe/src/types-ambient.js | 2 +- packages/zoe/src/zoeService/types-ambient.js | 2 +- 20 files changed, 22 insertions(+), 21 deletions(-) diff --git a/packages/ERTP/src/types.js b/packages/ERTP/src/types.js index d192706d734..64dca7c5c8a 100644 --- a/packages/ERTP/src/types.js +++ b/packages/ERTP/src/types.js @@ -3,7 +3,7 @@ // Ensure this is a module. export {}; -/// +/// /** * @import {Passable, RemotableObject} from '@endo/pass-style') * @import {CopyBag, CopySet, Key} from '@endo/patterns') diff --git a/packages/agoric-cli/src/publish.js b/packages/agoric-cli/src/publish.js index 6c0e99924e6..248c3adae54 100644 --- a/packages/agoric-cli/src/publish.js +++ b/packages/agoric-cli/src/publish.js @@ -1,5 +1,5 @@ // @ts-check -/// +/// import { E } from '@endo/far'; diff --git a/packages/assert/src/types-ambient.js b/packages/assert/src/types-ambient.js index b01ecee9e3b..b8064f03108 100644 --- a/packages/assert/src/types-ambient.js +++ b/packages/assert/src/types-ambient.js @@ -1,5 +1,5 @@ // @ts-check -/// +/// // Based on // https://github.com/endojs/endo/blob/HEAD/packages/ses/src/error/types.js diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index 5792b6c8ede..0e0bad948cd 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -1,4 +1,4 @@ -/// +/// import { E, Far } from '@endo/far'; import * as tendermint34 from '@cosmjs/tendermint-rpc'; diff --git a/packages/inter-protocol/test/psm/gov-replace-committee.js b/packages/inter-protocol/test/psm/gov-replace-committee.js index b222a09ee37..0a28d34bc51 100644 --- a/packages/inter-protocol/test/psm/gov-replace-committee.js +++ b/packages/inter-protocol/test/psm/gov-replace-committee.js @@ -1,6 +1,6 @@ /* global E */ // @ts-check -/// +/// /** * @file Script to replace the econ governance committee in a SwingSet Core Eval * (aka big hammer) diff --git a/packages/internal/src/index.js b/packages/internal/src/index.js index ee98585a187..2313cb3d5f5 100644 --- a/packages/internal/src/index.js +++ b/packages/internal/src/index.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// export * from './config.js'; export * from './debug.js'; diff --git a/packages/notifier/src/asyncIterableAdaptor.js b/packages/notifier/src/asyncIterableAdaptor.js index 65e266e2baf..36a37be6151 100644 --- a/packages/notifier/src/asyncIterableAdaptor.js +++ b/packages/notifier/src/asyncIterableAdaptor.js @@ -1,4 +1,4 @@ -/// +/// import { E } from '@endo/far'; import { subscribeLatest } from './subscribe.js'; diff --git a/packages/notifier/src/notifier.js b/packages/notifier/src/notifier.js index f2f50d4ea05..42ed192c1fa 100644 --- a/packages/notifier/src/notifier.js +++ b/packages/notifier/src/notifier.js @@ -1,4 +1,4 @@ -/// +/// import { assert } from '@agoric/assert'; import { E, Far } from '@endo/far'; diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js index 7efff5b45df..ea1d2c5f636 100644 --- a/packages/notifier/src/publish-kit.js +++ b/packages/notifier/src/publish-kit.js @@ -1,4 +1,4 @@ -/// +/// import { canBeDurable, prepareExoClassKit } from '@agoric/vat-data'; import { E, Far } from '@endo/far'; diff --git a/packages/notifier/src/subscriber.js b/packages/notifier/src/subscriber.js index 6d33758754d..8a613423eb4 100644 --- a/packages/notifier/src/subscriber.js +++ b/packages/notifier/src/subscriber.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// import { E, Far } from '@endo/far'; import { subscribeEach } from './subscribe.js'; diff --git a/packages/pegasus/src/types.js b/packages/pegasus/src/types.js index 921139ce8f8..6a146895807 100644 --- a/packages/pegasus/src/types.js +++ b/packages/pegasus/src/types.js @@ -1,6 +1,6 @@ // @ts-check -/// +/// /** * @import {Bytes, ConnectionHandler} from '@agoric/network'; */ diff --git a/packages/store/src/types.js b/packages/store/src/types.js index 45978b51cf4..0d7cf9f6d05 100644 --- a/packages/store/src/types.js +++ b/packages/store/src/types.js @@ -1,4 +1,4 @@ -/// +/// // Ensure this is a module. export {}; diff --git a/packages/time/src/types.d.ts b/packages/time/src/types.d.ts index 007f66c5939..ec211522ecb 100644 --- a/packages/time/src/types.d.ts +++ b/packages/time/src/types.d.ts @@ -2,7 +2,7 @@ import type { ERef, RemotableBrand } from '@endo/eventual-send'; import type { RankComparison, RemotableObject } from '@endo/marshal'; -/// +/// // These aren't in the global runtime environment. They are just types that are // meant to be globally accessible as a side-effect of importing this module. diff --git a/packages/vat-data/src/index.js b/packages/vat-data/src/index.js index 3bce4c80258..1ae559129ec 100644 --- a/packages/vat-data/src/index.js +++ b/packages/vat-data/src/index.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// export { M, makeScalarMapStore, diff --git a/packages/vats/src/core/core-eval-env.d.ts b/packages/vats/src/core/core-eval-env.d.ts index 2fb497f6084..f8df6a43e16 100644 --- a/packages/vats/src/core/core-eval-env.d.ts +++ b/packages/vats/src/core/core-eval-env.d.ts @@ -2,8 +2,9 @@ /** * @file typesdef for the CoreEval environment * - * To use add this to the top of the proposal: /// + * To use add this to the top of the proposal + * + * /// * * That directive has to be before imports, but this one's only useful in * modules that have no imports or named exports. diff --git a/packages/xsnap-lockdown/lib/ses-boot-debug.js b/packages/xsnap-lockdown/lib/ses-boot-debug.js index 67de157d96d..e044c73646f 100644 --- a/packages/xsnap-lockdown/lib/ses-boot-debug.js +++ b/packages/xsnap-lockdown/lib/ses-boot-debug.js @@ -5,7 +5,7 @@ /* eslint-disable import/no-extraneous-dependencies */ -/// +/// import { setObjectInspector } from './console-shim.js'; import '@endo/init/debug.js'; diff --git a/packages/xsnap-lockdown/lib/ses-boot.js b/packages/xsnap-lockdown/lib/ses-boot.js index 9764756b477..d18a0c739f8 100644 --- a/packages/xsnap-lockdown/lib/ses-boot.js +++ b/packages/xsnap-lockdown/lib/ses-boot.js @@ -5,7 +5,7 @@ /* eslint-disable import/no-extraneous-dependencies */ -/// +/// import { setObjectInspector } from './console-shim.js'; import '@endo/init'; diff --git a/packages/zoe/src/contractSupport/types-ambient.js b/packages/zoe/src/contractSupport/types-ambient.js index c1341d1768c..a285ce8c9d5 100644 --- a/packages/zoe/src/contractSupport/types-ambient.js +++ b/packages/zoe/src/contractSupport/types-ambient.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// /** * @typedef {object} SeatGainsLossesRecord diff --git a/packages/zoe/src/types-ambient.js b/packages/zoe/src/types-ambient.js index dd640c50611..b986b272c06 100644 --- a/packages/zoe/src/types-ambient.js +++ b/packages/zoe/src/types-ambient.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// /** * @template {string} H - the name of the handle diff --git a/packages/zoe/src/zoeService/types-ambient.js b/packages/zoe/src/zoeService/types-ambient.js index 24322cf7099..48cf7fc822f 100644 --- a/packages/zoe/src/zoeService/types-ambient.js +++ b/packages/zoe/src/zoeService/types-ambient.js @@ -1,6 +1,6 @@ // @jessie-check -/// +/// /** * @typedef {object} ZoeService From c6c0a3905a7cb47c2aef19b8f61dbd60f5a877c5 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 16 May 2024 09:50:43 -0700 Subject: [PATCH 15/15] refactor(types): references for ambients --- packages/ERTP/src/index.js | 1 + packages/cache/src/main.js | 4 +--- packages/casting/src/main.js | 2 +- packages/governance/src/index.js | 6 ++---- packages/inter-protocol/src/auction/auctionBook.js | 5 +++-- packages/inter-protocol/src/auction/auctioneer.js | 2 +- packages/inter-protocol/src/econCommitteeCharter.js | 2 +- packages/inter-protocol/src/index.js | 1 + packages/inter-protocol/src/psm/psm.js | 2 +- packages/inter-protocol/src/vaultFactory/vaultDirector.js | 3 +-- packages/inter-protocol/src/vaultFactory/vaultFactory.js | 2 +- packages/notifier/src/index.js | 4 +--- packages/orchestration/index.js | 6 ++++++ .../src/proposals/upgrade-wallet-factory2-proposal.js | 5 ++--- packages/vats/src/core/core-eval-env.d.ts | 2 +- packages/zoe/src/zoeService/zoe.js | 6 ++---- 16 files changed, 26 insertions(+), 27 deletions(-) diff --git a/packages/ERTP/src/index.js b/packages/ERTP/src/index.js index 7e0eefc6aa9..67348c97035 100644 --- a/packages/ERTP/src/index.js +++ b/packages/ERTP/src/index.js @@ -1,4 +1,5 @@ // @jessie-check +/// export * from './amountMath.js'; export * from './issuerKit.js'; diff --git a/packages/cache/src/main.js b/packages/cache/src/main.js index f13abd7ef3f..3c648aa4159 100644 --- a/packages/cache/src/main.js +++ b/packages/cache/src/main.js @@ -1,7 +1,5 @@ // @jessie-check - -// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/internal/exported.js'; +/// // eslint-disable-next-line import/export export * from './types.js'; diff --git a/packages/casting/src/main.js b/packages/casting/src/main.js index c4ea270603c..6b0eee6ec01 100644 --- a/packages/casting/src/main.js +++ b/packages/casting/src/main.js @@ -1,6 +1,6 @@ // @jessie-check -import '@agoric/internal/exported.js'; +/// // eslint-disable-next-line import/export export * from './types.js'; // no named exports diff --git a/packages/governance/src/index.js b/packages/governance/src/index.js index b3e2cc5a24d..68ee491623f 100644 --- a/packages/governance/src/index.js +++ b/packages/governance/src/index.js @@ -1,10 +1,8 @@ +/// +/// // XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/internal/exported.js'; -import '@agoric/ertp/exported.js'; import '@agoric/zoe/exported.js'; -/// - export { ChoiceMethod, ElectionType, diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index 46f63f03666..348692166b5 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -1,6 +1,7 @@ +/// +/// + // XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/internal/exported.js'; -import '@agoric/governance/exported.js'; import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index 88ace013d94..fbed644898b 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -1,4 +1,4 @@ -import '@agoric/governance/exported.js'; +/// import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; diff --git a/packages/inter-protocol/src/econCommitteeCharter.js b/packages/inter-protocol/src/econCommitteeCharter.js index 6fc146cb167..632ea5beb43 100644 --- a/packages/inter-protocol/src/econCommitteeCharter.js +++ b/packages/inter-protocol/src/econCommitteeCharter.js @@ -1,6 +1,6 @@ // @jessie-check +/// -import '@agoric/governance/exported.js'; import { M, mustMatch } from '@agoric/store'; import { TimestampShape } from '@agoric/time'; import { prepareExo, provideDurableMapStore } from '@agoric/vat-data'; diff --git a/packages/inter-protocol/src/index.js b/packages/inter-protocol/src/index.js index 6afa8fdbdfe..4708dc05b7c 100644 --- a/packages/inter-protocol/src/index.js +++ b/packages/inter-protocol/src/index.js @@ -1,3 +1,4 @@ // @jessie-check +/// export { calculateCurrentDebt } from './interest-math.js'; diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index fbd44b7d496..74ba3c7364c 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -1,7 +1,7 @@ // @jessie-check +/// // XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/governance/exported.js'; import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; diff --git a/packages/inter-protocol/src/vaultFactory/vaultDirector.js b/packages/inter-protocol/src/vaultFactory/vaultDirector.js index 701dc0ac80c..4c85139b209 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultDirector.js +++ b/packages/inter-protocol/src/vaultFactory/vaultDirector.js @@ -1,8 +1,7 @@ +/// import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; -import '@agoric/governance/exported.js'; - import { AmountMath, AmountShape, BrandShape, IssuerShape } from '@agoric/ertp'; import { GovernorFacetShape, diff --git a/packages/inter-protocol/src/vaultFactory/vaultFactory.js b/packages/inter-protocol/src/vaultFactory/vaultFactory.js index 2ee4f2001ae..f3942a3576f 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultFactory.js +++ b/packages/inter-protocol/src/vaultFactory/vaultFactory.js @@ -1,7 +1,7 @@ // @jessie-check +/// // XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/governance/exported.js'; import '@agoric/zoe/exported.js'; import '@agoric/zoe/src/contracts/exported.js'; diff --git a/packages/notifier/src/index.js b/packages/notifier/src/index.js index 2a5f7fd6723..4033aad55bc 100644 --- a/packages/notifier/src/index.js +++ b/packages/notifier/src/index.js @@ -1,7 +1,5 @@ // @jessie-check - -// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/internal/exported.js'; +/// export { makePublishKit, diff --git a/packages/orchestration/index.js b/packages/orchestration/index.js index d5173404ac0..89ffac18b7e 100644 --- a/packages/orchestration/index.js +++ b/packages/orchestration/index.js @@ -1,3 +1,9 @@ +/// +/// + +// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 +import '@agoric/zoe/exported.js'; + export * from './src/types.js'; export * from './src/service.js'; export * from './src/typeGuards.js'; diff --git a/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js b/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js index 2ebb86e3fc5..a4750423d07 100644 --- a/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js +++ b/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js @@ -1,10 +1,9 @@ // @ts-check +/// + import { E } from '@endo/far'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; -// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/vats/src/core/types-ambient.js'; - /** * @param {BootstrapPowers & ChainBootstrapSpace} powers * @param {object} options diff --git a/packages/vats/src/core/core-eval-env.d.ts b/packages/vats/src/core/core-eval-env.d.ts index f8df6a43e16..cb1f87b419b 100644 --- a/packages/vats/src/core/core-eval-env.d.ts +++ b/packages/vats/src/core/core-eval-env.d.ts @@ -2,7 +2,7 @@ /** * @file typesdef for the CoreEval environment * - * To use add this to the top of the proposal + * To use add this to the top of the proposal: * * /// * diff --git a/packages/zoe/src/zoeService/zoe.js b/packages/zoe/src/zoeService/zoe.js index 5a83d08bf0a..71abd32ce46 100644 --- a/packages/zoe/src/zoeService/zoe.js +++ b/packages/zoe/src/zoeService/zoe.js @@ -11,6 +11,8 @@ * validate that. */ +/// +/// /// import { E } from '@endo/eventual-send'; @@ -26,10 +28,6 @@ import { getZcfBundleCap } from './createZCFVat.js'; import { defaultFeeIssuerConfig, prepareFeeMint } from './feeMint.js'; import { ZoeServiceI } from '../typeGuards.js'; -// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512 -import '@agoric/internal/exported.js'; -import '@agoric/notifier/exported.js'; - /** @import {Baggage} from '@agoric/vat-data' */ const { Fail } = assert;