Skip to content

Commit

Permalink
chore(types): ESM module suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Oct 17, 2024
1 parent 9eece6f commit 84e4143
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions packages/bundle-source/src/bundle-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const SUPPORTED_FORMATS = [
'endoScript',
];

/** @type {import('./types').BundleSource} */
/** @type {import('./types.js').BundleSource} */
// @ts-ignore cast
const bundleSource = async (
startFilename,
Expand All @@ -18,7 +18,7 @@ const bundleSource = async (
if (typeof options === 'string') {
options = { format: options };
}
/** @type {{ format: import('./types').ModuleFormat }} */
/** @type {{ format: import('./types.js').ModuleFormat }} */
// @ts-expect-error cast (xxx params)
const { format: moduleFormat = DEFAULT_MODULE_FORMAT } = options;

Expand Down
44 changes: 22 additions & 22 deletions packages/eventual-send/src/E.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const baseFreezableProxyHandler = {
* A Proxy handler for E(x).
*
* @param {any} recipient Any value passed to E(x)
* @param {import('./types').HandledPromiseConstructor} HandledPromise
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeEProxyHandler = (recipient, HandledPromise) =>
Expand Down Expand Up @@ -96,7 +96,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').HandledPromiseConstructor} HandledPromise
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeESendOnlyProxyHandler = (recipient, HandledPromise) =>
Expand Down Expand Up @@ -153,7 +153,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').HandledPromiseConstructor} HandledPromise
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @returns {ProxyHandler<unknown>} the Proxy handler
*/
const makeEGetProxyHandler = (x, HandledPromise) =>
Expand All @@ -164,7 +164,7 @@ const makeEGetProxyHandler = (x, HandledPromise) =>
});

/**
* @param {import('./types').HandledPromiseConstructor} HandledPromise
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
*/
const makeE = HandledPromise => {
return harden(
Expand Down Expand Up @@ -255,15 +255,15 @@ export default makeE;
*
* @template Primary The type of the primary reference.
* @template [Local=DataOnly<Primary>] The local properties of the object.
* @typedef {ERef<Local & import('./types').RemotableBrand<Local, Primary>>} FarRef
* @typedef {ERef<Local & import('./types.js').RemotableBrand<Local, Primary>>} FarRef
*/

/**
* `DataOnly<T>` means to return a record type `T2` consisting only of
* properties that are *not* functions.
*
* @template T The type to be filtered.
* @typedef {Omit<T, FilteredKeys<T, import('./types').Callable>>} DataOnly
* @typedef {Omit<T, FilteredKeys<T, import('./types.js').Callable>>} DataOnly
*/

/**
Expand All @@ -273,7 +273,7 @@ export default makeE;
*/

/**
* @template {import('./types').Callable} T
* @template {import('./types.js').Callable} T
* @typedef {(
* ReturnType<T> extends PromiseLike<infer U> // if function returns a promise
* ? T // return the function
Expand All @@ -284,7 +284,7 @@ export default makeE;
/**
* @template T
* @typedef {{
* readonly [P in keyof T]: T[P] extends import('./types').Callable
* readonly [P in keyof T]: T[P] extends import('./types.js').Callable
* ? ECallable<T[P]>
* : never;
* }} EMethods
Expand All @@ -300,14 +300,14 @@ export default makeE;
*/

/**
* @template {import('./types').Callable} T
* @template {import('./types.js').Callable} T
* @typedef {(...args: Parameters<T>) => Promise<void>} ESendOnlyCallable
*/

/**
* @template T
* @typedef {{
* readonly [P in keyof T]: T[P] extends import('./types').Callable
* readonly [P in keyof T]: T[P] extends import('./types.js').Callable
* ? ESendOnlyCallable<T[P]>
* : never;
* }} ESendOnlyMethods
Expand All @@ -316,7 +316,7 @@ export default makeE;
/**
* @template T
* @typedef {(
* T extends import('./types').Callable
* T extends import('./types.js').Callable
* ? ESendOnlyCallable<T> & ESendOnlyMethods<Required<T>>
* : ESendOnlyMethods<Required<T>>
* )} ESendOnlyCallableOrMethods
Expand All @@ -325,7 +325,7 @@ export default makeE;
/**
* @template T
* @typedef {(
* T extends import('./types').Callable
* T extends import('./types.js').Callable
* ? ECallable<T> & EMethods<Required<T>>
* : EMethods<Required<T>>
* )} ECallableOrMethods
Expand All @@ -352,9 +352,9 @@ export default makeE;
*
* @template T
* @typedef {(
* T extends import('./types').Callable
* T extends import('./types.js').Callable
* ? (...args: Parameters<T>) => ReturnType<T> // a root callable, no methods
* : Pick<T, FilteredKeys<T, import('./types').Callable>> // any callable methods
* : Pick<T, FilteredKeys<T, import('./types.js').Callable>> // any callable methods
* )} PickCallable
*/

Expand All @@ -363,9 +363,9 @@ export default makeE;
*
* @template T
* @typedef {(
* T extends import('./types').RemotableBrand<infer L, infer R> // if a given T is some remote interface R
* T extends import('./types.js').RemotableBrand<infer L, infer R> // if a given T is some remote interface R
* ? PickCallable<R> // then return the callable properties of R
* : Awaited<T> extends import('./types').RemotableBrand<infer L, infer R> // otherwise, if the final resolution of T is some remote interface R
* : Awaited<T> extends import('./types.js').RemotableBrand<infer L, infer R> // otherwise, if the final resolution of T is some remote interface R
* ? PickCallable<R> // then return the callable properties of R
* : T extends PromiseLike<infer U> // otherwise, if T is a promise
* ? Awaited<T> // then return resolved value T
Expand All @@ -376,9 +376,9 @@ export default makeE;
/**
* @template T
* @typedef {(
* T extends import('./types').RemotableBrand<infer L, infer R>
* T extends import('./types.js').RemotableBrand<infer L, infer R>
* ? L
* : Awaited<T> extends import('./types').RemotableBrand<infer L, infer R>
* : Awaited<T> extends import('./types.js').RemotableBrand<infer L, infer R>
* ? L
* : T extends PromiseLike<infer U>
* ? Awaited<T>
Expand All @@ -390,7 +390,7 @@ export default makeE;
* @template [R = unknown]
* @typedef {{
* promise: Promise<R>;
* settler: import('./types').Settler<R>;
* settler: import('./types.js').Settler<R>;
* }} EPromiseKit
*/

Expand All @@ -400,11 +400,11 @@ export default makeE;
*
* @template T
* @typedef {(
* T extends import('./types').Callable
* T extends import('./types.js').Callable
* ? (...args: Parameters<T>) => ERef<Awaited<EOnly<ReturnType<T>>>>
* : T extends Record<PropertyKey, import('./types').Callable>
* : T extends Record<PropertyKey, import('./types.js').Callable>
* ? {
* [K in keyof T]: T[K] extends import('./types').Callable
* [K in keyof T]: T[K] extends import('./types.js').Callable
* ? (...args: Parameters<T[K]>) => ERef<Awaited<EOnly<ReturnType<T[K]>>>>
* : T[K];
* }
Expand Down
6 changes: 3 additions & 3 deletions packages/eventual-send/src/postponed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Create a simple postponedHandler that just postpones until donePostponing is
* called.
*
* @param {import('./types').HandledPromiseConstructor} HandledPromise
* @returns {[Required<import('./types').Handler<any>>, () => void]} postponedHandler and donePostponing callback.
* @param {import('./types.js').HandledPromiseConstructor} HandledPromise
* @returns {[Required<import('./types.js').Handler<any>>, () => void]} postponedHandler and donePostponing callback.
*/
export const makePostponedHandler = HandledPromise => {
/** @type {() => void} */
Expand All @@ -29,7 +29,7 @@ export const makePostponedHandler = HandledPromise => {
};
};

/** @type {Required<import('./types').Handler<any>>} */
/** @type {Required<import('./types.js').Handler<any>>} */
const postponedHandler = {
get: makePostponedOperation('get'),
getSendOnly: makePostponedOperation('getSendOnly'),
Expand Down
10 changes: 5 additions & 5 deletions packages/pass-style/src/types.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable */
import { expectAssignable, expectType, expectNotType } from 'tsd';
import { Far } from './make-far';
import { passStyleOf } from './passStyleOf';
import { makeTagged } from './makeTagged';
import { CopyTagged, Passable, PassStyle } from './types';
import { PASS_STYLE } from './passStyle-helpers';
import { Far } from './make-far.js';
import { passStyleOf } from './passStyleOf.js';
import { makeTagged } from './makeTagged.js';
import { CopyTagged, Passable, PassStyle } from './types.js';
import { PASS_STYLE } from './passStyle-helpers.js';

const remotable = Far('foo', {});

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.eslint-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"compilerOptions": {
"allowJs": true,
"target": "esnext",
"module": "esnext",
"module": "NodeNext",
"checkJs": true,
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"moduleResolution": "node"
"moduleResolution": "NodeNext"
},
"include": [],
"exclude": [
Expand Down

0 comments on commit 84e4143

Please sign in to comment.