import { isUndefined } from '@typed/logic' ; import { Id , JsonRpcRequest , StructuredJson } from '../../model' ; export function createRequest < A extends string > ( id , method ) ; export function createRequest < A extends string , B extends StructuredJson > ( id , method , params ) ; export function createRequest < A extends string , B extends StructuredJson > ( id , method , params ? ) { const request = { jsonrpc : '2.0' , id , method } ; if ( isUndefined ( params ) ) { return request as JsonRpcRequest < A , B > ; } return { ... request , params } as JsonRpcRequest < A , B > ; }