From 0463c6bb0f8fd32740ceb61ccce04c662272a618 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 23 Apr 2019 22:35:26 +0900 Subject: Refactor API (#4770) * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update description.ts * wip --- src/server/api/define.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/server/api/define.ts') diff --git a/src/server/api/define.ts b/src/server/api/define.ts index 990cbf2a86..1e2600add0 100644 --- a/src/server/api/define.ts +++ b/src/server/api/define.ts @@ -3,6 +3,7 @@ import { ILocalUser } from '../../models/entities/user'; import { IEndpointMeta } from './endpoints'; import { ApiError } from './error'; import { App } from '../../models/entities/app'; +import { SchemaType } from '../../misc/schema'; type Params = { [P in keyof T['params']]: NonNullable[P]['transform'] extends Function @@ -12,7 +13,11 @@ type Params = { export type Response = Record | void; -export default function (meta: T, cb: (params: Params, user: ILocalUser, app: App, file?: any, cleanup?: Function) => Promise): (params: any, user: ILocalUser, app: App, file?: any) => Promise { +type executor = + (params: Params, user: ILocalUser, app: App, file?: any, cleanup?: Function) => Promise>>; + +export default function (meta: T, cb: executor) + : (params: any, user: ILocalUser, app: App, file?: any) => Promise { return (params: any, user: ILocalUser, app: App, file?: any) => { function cleanup() { fs.unlink(file.path, () => {}); -- cgit v1.2.3-freya