Skip to content

Commit

Permalink
fix: changes to ObjectEmpty type to be in line with polykey
Browse files Browse the repository at this point in the history
  • Loading branch information
amydevs committed Oct 30, 2023
1 parent fe7af00 commit 92e5919
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ const defaultClientMiddlewareWrapper = (
export {
binaryToJsonMessageStream,
jsonMessageToBinaryStream,
timeoutMiddlewareClient,
timeoutMiddlewareServer,
defaultMiddleware,
defaultServerMiddlewareWrapper,
defaultClientMiddlewareWrapper,
timeoutMiddlewareClient,
timeoutMiddlewareServer,
};
7 changes: 6 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ type JSONRPCResponseError = {
id: string | number | null;
};

type ObjectEmpty = NonNullable<unknown>;
/**
* Used when an empty object is needed.
* Defined here with a linter override to avoid a false positive.
*/
// eslint-disable-next-line
type ObjectEmpty = {};

// Prevent overwriting the metadata type with `Omit<>`
type JSONRPCRequestMetadata<T extends Record<string, JSONValue> = ObjectEmpty> =
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ function toError(
let e: Error;
switch (eClass) {
case AbstractError:
case errors.ErrorRPCTimedOut:
e = eClass.fromJSON(errorData);
break;
case AggregateError:
Expand Down

0 comments on commit 92e5919

Please sign in to comment.