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 16, 2023
1 parent 8ae09f4 commit 3764eee
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 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/core-eval-env"/>
/**
* @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/core-eval-env.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/core-eval-env"/>
*
* 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
}

0 comments on commit 3764eee

Please sign in to comment.