generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
The resulting type of JsonRpcRequest:
export declare const JsonRpcRequestStruct: Struct<{
id: string | number | null;
method: string;
jsonrpc: "2.0";
params?: Json[] | Record<string, Json> | undefined;
}, {
id: Struct<string | number | null, null>;
jsonrpc: Struct<"2.0", "2.0">;
method: Struct<string, null>;
params: Struct<Json[] | Record<string, Json> | undefined, null>;
}>;
export declare type JsonRpcRequest<Params extends JsonRpcParams = JsonRpcParams> = InferWithParams<typeof JsonRpcRequestStruct, Params>;
This allows explicit undefined value for params, which is invalid JSON since undefined is not a valid JSON value. params?: Json[] | Record<string, Json> | undefined; should be params?: Json[] | Record<string, Json>;.
It seems like superstruct-derived optional always get a | undefined, which makes the resolution less obvious to me.
Metadata
Metadata
Assignees
Labels
No labels