import { JsonRpcErrorResponse , JsonRpcRequest , JsonRpcResponse , } from './transport.interface' ; import { Range } from './range' ; import { ZERO } from '../app' ; param response returns export const isJsonRpcErrorResponse = ( response ) : response is JsonRpcErrorResponse => { return typeof ( response as JsonRpcErrorResponse ) . error !== 'undefined' ; } ; param request returns export const isJsonRpcRequest = ( request ) : request is JsonRpcRequest => { return ( request . method !== undefined && request . id !== undefined && request . jsonrpc === '2.0' ) ; } ; param range returns export const isValidRange = ( range ) : range is Range => { return ( ! ! range && ! ! range . start && ! ! range . end && range . start . gte ( ZERO ) && range . end . gt ( range . start ) ) ; } ;