Skip to content

Commit

Permalink
feat(types): coreEvalEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 15, 2023
1 parent 2ef5e46 commit 6bb6744
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/inter-protocol/test/psm/gov-replace-committee.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global E */
// @ts-nocheck
// @ts-check
/// <reference types="@agoric/vats/src/core/coreEvalEnv"/>
/**
* @file Script to replace the econ governance committee in a SwingSet Core Eval
* (aka big hammer)
Expand All @@ -26,12 +27,12 @@ const { values } = Object;
const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]);

/**
* @param {ERef<NameAdmin>} nameAdmin
* @param {ERef<import('@agoric/vats').NameAdmin>} nameAdmin
* @param {string[][]} paths
*/
const reserveThenGetNamePaths = async (nameAdmin, paths) => {
/**
* @param {ERef<NameAdmin>} nextAdmin
* @param {ERef<import('@agoric/vats').NameAdmin>} nextAdmin
* @param {string[]} path
*/
const nextPath = async (nextAdmin, path) => {
Expand Down
37 changes: 37 additions & 0 deletions packages/vats/src/core/coreEvalEnv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* eslint-disable */
/**
* @file typesdef for the CoreEval environment
*
* To use add this to the top of the proposal: /// <reference
* types="@agoric/vats/src/core/coreEvalEnv"/>
*
* That directive has to be before imports, but this one's only useful in
* modules that have no imports or named exports.
*/

import type { VatData } from '@agoric/swingset-liveslots/src/vatDataTypes.js';
import type { E, Far, getInterfaceOf, passStyleOf } from '@endo/far';
import type { Assert, VirtualConsole } from 'ses';
import type { BootstrapModules } from './boot-chain.js';

// Provided by 'CORE_EVAL' handler in chain-behaviors.js
declare global {
// bootstrap modules
var behaviors: BootstrapModules['behaviors'];
var utils: BootstrapModules['utils'];

// @endo/far exports
var E: E;
var Far: Far;
var getInterfaceOfFar: getInterfaceOfFar;
var passStyleOfFar: passStyleOfFar;

// endowments
var VatData: VatData;
var assert: Assert;

// console is a VirtualConsole but this directive fails to override the extant global `console`
// var console: VirtualConsole;

// Base64 and URL are not available in all environments
}
3 changes: 2 additions & 1 deletion packages/vats/src/proposals/null-upgrade-zoe-proposal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { E } from '@endo/far';
/* global E */
/// <reference types="@agoric/vats/src/core/coreEvalEnv"/>

/**
* @param {BootstrapPowers & {
Expand Down

0 comments on commit 6bb6744

Please sign in to comment.