Skip to content

Commit

Permalink
JSON RPC types now have default Params value (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritave authored and Mrtenz committed Dec 2, 2022
1 parent b8b9978 commit 9a9c38a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/json.ts
Expand Up @@ -130,20 +130,16 @@ export type InferWithParams<
/**
* A JSON-RPC request object.
*/
export type JsonRpcRequest<Params extends JsonRpcParams> = InferWithParams<
typeof JsonRpcRequestStruct,
Params
>;
export type JsonRpcRequest<Params extends JsonRpcParams = JsonRpcParams> =
InferWithParams<typeof JsonRpcRequestStruct, Params>;

export const JsonRpcNotificationStruct = omit(JsonRpcRequestStruct, ['id']);

/**
* A JSON-RPC notification object.
*/
export type JsonRpcNotification<Params extends JsonRpcParams> = InferWithParams<
typeof JsonRpcNotificationStruct,
Params
>;
export type JsonRpcNotification<Params extends JsonRpcParams = JsonRpcParams> =
InferWithParams<typeof JsonRpcNotificationStruct, Params>;

/**
* Check if the given value is a valid {@link JsonRpcNotification} object.
Expand Down

0 comments on commit 9a9c38a

Please sign in to comment.