Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Aug 30, 2023

This is intended to be merged into @legobeat's branch (#134).

@legobeat
Copy link
Contributor

Result from dist/types/json.d.ts after yarn build:

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 InferWithParams<Type extends Struct<any>, Params extends JsonRpcParams> = Omit<Infer<Type>, 'params'> & {
    params?: Exclude<Params, undefined>;
};
/**
 * A JSON-RPC request object.
 */
export declare type JsonRpcRequest<Params extends JsonRpcParams = JsonRpcParams> = InferWithParams<typeof JsonRpcRequestStruct, Params>;
export declare const JsonRpcNotificationStruct: Struct<{
    method: string;
    jsonrpc: "2.0";
    params?: Json[] | Record<string, Json> | undefined;
}, {
    jsonrpc: Struct<"2.0", "2.0">;
    method: Struct<string, null>;
    params: Struct<Json[] | Record<string, Json> | undefined, null>;
}>;

@Mrtenz Mrtenz closed this Aug 30, 2023
@Mrtenz Mrtenz deleted the mrtenz/reduce-type-duplication branch August 30, 2023 10:24
@legobeat
Copy link
Contributor

This is now part of #134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants