-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
30 lines (30 loc) · 1.02 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// export declare function KoaMiddleware<T>(ctx:T, next:()=>Promise<any>) : Promise<any>
// type MiddlewaresObj<T>={[K:string] : KoaMiddleware<T>}
export default useOnion
declare function useOnion<T, H>(
ctx :T,
confs :{
baseHook ?: {[K in keyof H]: (ctx:T,next:()=>Promise<any>)=> Promise<any>},
customHook ?:{[K in keyof H]: (ctx:T,next:()=>Promise<any>)=> Promise<any>},
hasArgFnNames ?: [keyof H][number][]
syncFnNames ?: [keyof H][number][]
}
)
declare namespace useOnion{
const curr_base_hook :string
const has_arg_fn_prefix :string
const onerror :string
}
export function getSyncMidware<T>(fn :(ctx:T)=>any) :(ctx :T, next:Function)=>any;
export function getAsyncMidware<T>(fn :(ctx:T)=>any) :(ctx :T, next:Function)=>Promise<any>;
/*
import baseHook from './baseCrudHooks'
import uo from '../main'
uo({
form:{ data:{title:'标题',num:233} },
table:{ data:[{id:1,name:'名字'}] }
},
{baseHook, customHook:{
arg_delById:ctx=>{ctx}
} , hasArgFnNames:[''] }
)*/