Fix comments-server
This commit is contained in:
parent
73c27aec6a
commit
9165b96e0f
@ -1,9 +1,8 @@
|
|||||||
export type Id = number | string
|
export type Id = number | string
|
||||||
import {ArgumentTypes, FunctionPropertyNames, RetType} from './types'
|
import { getValidatorsForInstance, getValidatorsForMethod, Validate } from './ensure'
|
||||||
import {isPromise} from './isPromise'
|
import { createError, ErrorResponse } from './error'
|
||||||
import {createError, ErrorResponse} from './error'
|
import { isPromise } from './isPromise'
|
||||||
import {getValidatorsForMethod, getValidatorsForInstance} from './ensure'
|
import { ArgumentTypes, FunctionPropertyNames, RetType } from './types'
|
||||||
import {Validate} from './ensure'
|
|
||||||
|
|
||||||
export const ERROR_PARSE = {
|
export const ERROR_PARSE = {
|
||||||
code: -32700,
|
code: -32700,
|
||||||
@ -78,7 +77,8 @@ export interface SuccessResponse<T> {
|
|||||||
export type Response<T = any> = SuccessResponse<T> | ErrorResponse<T>
|
export type Response<T = any> = SuccessResponse<T> | ErrorResponse<T>
|
||||||
|
|
||||||
export function createSuccessResponse<T>(
|
export function createSuccessResponse<T>(
|
||||||
id: number | string, result: T
|
id: number | string,
|
||||||
|
result: T,
|
||||||
): SuccessResponse<T> {
|
): SuccessResponse<T> {
|
||||||
return {
|
return {
|
||||||
jsonrpc: '2.0',
|
jsonrpc: '2.0',
|
||||||
|
|||||||
@ -26,7 +26,7 @@ describe('remote', () => {
|
|||||||
return a + b
|
return a + b
|
||||||
}
|
}
|
||||||
async fetchItem(
|
async fetchItem(
|
||||||
ctx: {}, obj1: {a: number}, obj2: {b: number}
|
ctx: {}, obj1: {a: number}, obj2: {b: number},
|
||||||
): Promise<{a: number, b: number}> {
|
): Promise<{a: number, b: number}> {
|
||||||
return Promise.resolve({...obj1, ...obj2})
|
return Promise.resolve({...obj1, ...obj2})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user