Skip to content

Commit 1e421de

Browse files
committed
WIP: fix JsonRpcRequest to be valid json
fix/types: JsonRpcParams should be valid JSON values `undefined` is not valid JSON. https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf (Section 5): A JSON value can be an object, array, number, string, true, false, or null.
1 parent 20bb059 commit 1e421de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/json.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ export type JsonRpcError = OptionalField<
177177
'data'
178178
>;
179179

180-
export const JsonRpcParamsStruct = optional(
180+
export const JsonRpcParamsStruct: Struct<Json[] | Record<string, Json>, null> = optional(
181181
union([record(string(), JsonStruct), array(JsonStruct)]),
182-
);
183-
export type JsonRpcParams = Infer<typeof JsonRpcParamsStruct>;
182+
) as any;
183+
184+
export type JsonRpcParams = Json[] | Record<string, Json>;
184185

185186
export const JsonRpcRequestStruct = object({
186187
id: JsonRpcIdStruct,

0 commit comments

Comments
 (0)