提交 c007f809 编写于 作者: fxy060608's avatar fxy060608

chore: build

上级 d8b7b569
......@@ -205,7 +205,10 @@ export function defineOffApi<T extends ApiLike>(
return wrapperOffApi(name, fn, options) as unknown as T
}
export function defineTaskApi<T extends TaskApiLike, P = AsyncApiOptions<T>>(
export function defineTaskApi<
T extends TaskApiLike,
P extends AsyncMethodOptionLike = AsyncApiOptions<T>
>(
name: string,
fn: (
args: Omit<P, CALLBACK_TYPES>,
......@@ -237,7 +240,10 @@ export function defineSyncApi<T extends ApiLike>(
) as unknown as T
}
export type DefineAsyncApiFn<T extends AsyncApiLike, P = AsyncApiOptions<T>> = (
export type DefineAsyncApiFn<
T extends AsyncApiLike,
P extends AsyncMethodOptionLike = AsyncApiOptions<T>
> = (
args: P extends undefined ? undefined : Omit<P, CALLBACK_TYPES>,
res: {
resolve: (res: AsyncApiRes<P> | void) => void
......@@ -245,7 +251,10 @@ export type DefineAsyncApiFn<T extends AsyncApiLike, P = AsyncApiOptions<T>> = (
}
) => void
export function defineAsyncApi<T extends AsyncApiLike, P = AsyncApiOptions<T>>(
export function defineAsyncApi<
T extends AsyncApiLike,
P extends AsyncMethodOptionLike = AsyncApiOptions<T>
>(
name: string,
fn: DefineAsyncApiFn<T>,
protocol?: ApiProtocols<T>,
......
......@@ -506,7 +506,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -375,7 +375,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
......@@ -411,7 +411,7 @@ function formatApiArgs(args, options) {
}
}
function invokeSuccess(id, name, res) {
return invokeCallback(id, extend(res || {}, { errMsg: name + ':ok' }));
return invokeCallback(id, extend((res || {}), { errMsg: name + ':ok' }));
}
function invokeFail(id, name, errMsg, errRes) {
return invokeCallback(id, extend({ errMsg: name + ':fail' + (errMsg ? ' ' + errMsg : '') }, errRes));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册