Skip to content

Commit

Permalink
chore(types): explicit imports
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Oct 17, 2024
1 parent 84e4143 commit 658eac3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
12 changes: 8 additions & 4 deletions packages/eventual-send/src/E.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { makeMessageBreakpointTester } from './message-breakpoints.js';
const { details: X, quote: q, Fail, error: makeError } = assert;
const { assign, create } = Object;

/**
* @import { HandledPromiseConstructor } from './types.js';
*/

const onSend = makeMessageBreakpointTester('ENDO_SEND_BREAKPOINTS');

/** @type {ProxyHandler<any>} */
Expand Down Expand Up @@ -35,7 +39,7 @@ const baseFreezableProxyHandler = {
* A Proxy handler for E(x).
*
* @param {any} recipient Any value passed to E(x)
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @param {HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeEProxyHandler = (recipient, HandledPromise) =>
Expand Down Expand Up @@ -96,7 +100,7 @@ const makeEProxyHandler = (recipient, HandledPromise) =>
* It is a variant on the E(x) Proxy handler.
*
* @param {any} recipient Any value passed to E.sendOnly(x)
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @param {HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeESendOnlyProxyHandler = (recipient, HandledPromise) =>
Expand Down Expand Up @@ -153,7 +157,7 @@ const makeESendOnlyProxyHandler = (recipient, HandledPromise) =>
* It is a variant on the E(x) Proxy handler.
*
* @param {any} x Any value passed to E.get(x)
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @param {HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeEGetProxyHandler = (x, HandledPromise) =>
Expand All @@ -164,7 +168,7 @@ const makeEGetProxyHandler = (x, HandledPromise) =>
});

/**
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @param {HandledPromiseConstructor} HandledPromise
*/
const makeE = HandledPromise => {
return harden(
Expand Down
2 changes: 0 additions & 2 deletions packages/ses/src/compartment-shim.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="ses"/>

import { globalThis } from './commons.js';
import { makeCompartmentConstructor } from './compartment.js';
import { tameFunctionToString } from './tame-function-tostring.js';
Expand Down
1 change: 1 addition & 0 deletions packages/ses/src/error/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { makeNoteLogArgsArrayKit } from './note-log-args.js';

/**
* @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, StringablePayload, DetailsToken, MakeAssert} from '../../types.js'
* @import {LogArgs, NoteCallback, LoggedErrorHandler} from "./internal-types.js";
*/

// For our internal debugging purposes, uncomment
Expand Down
7 changes: 5 additions & 2 deletions packages/ses/src/error/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ import {
weaksetAdd,
weaksetHas,
} from '../commons.js';
import './types.js';
import './internal-types.js';

/**
* @import {FilterConsole, LogSeverity, VirtualConsole} from './types.js'
* @import {ErrorInfo, ErrorInfoKind, LogRecord, NoteCallback, LoggedErrorHandler, MakeCausalConsole, MakeLoggingConsoleKit} from "./internal-types.js";
*/

// For our internal debugging purposes, uncomment
// const internalDebugConsole = console;
Expand Down
4 changes: 4 additions & 0 deletions packages/ses/src/error/internal-types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// @ts-check

/**
* @import {VirtualConsole} from './types.js'
*/

/**
* @typedef {readonly any[]} LogArgs
*
Expand Down
5 changes: 4 additions & 1 deletion packages/ses/src/error/note-log-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
/* eslint-disable no-restricted-globals */

import { makeLRUCacheMap } from '../make-lru-cachemap.js';
import './internal-types.js';

/**
* @import {LogArgs} from './internal-types.js';
*/

const { freeze } = Object;
const { isSafeInteger } = Number;
Expand Down
7 changes: 5 additions & 2 deletions packages/ses/src/error/tame-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import {
import { loggedErrorHandler as defaultHandler } from './assert.js';
import { makeCausalConsole } from './console.js';
import { makeRejectionHandlers } from './unhandled-rejection.js';
import './types.js';
import './internal-types.js';

/**
* @import {VirtualConsole} from './types.js'
* @import {GetStackString} from './internal-types.js';
*/

const failFast = message => {
throw TypeError(message);
Expand Down

0 comments on commit 658eac3

Please sign in to comment.