import { BridgeMethods , SpecialMethods , APBridgeMethods , PickSuccessResult , Fn } from './bridge' ; function mockServer < T > ( host , api , params ? ) { return new Promise ( ( resolve , reject ) => { my . request ( { url : `${ host }/jsapi/${ api }` , method : 'GET' , data : { ... params , } , success ( result ) { resolve ( result ) ; } , fail : reject , } ) ; } ) ; } export default { call : async function call < T extends keyof R , R extends Record < string , any > = BridgeMethods & SpecialMethods > ( host , api , params ? ) : Promise < PickSuccessResult < Parameters < R [ T ] > [ 0 ] > > { return mockServer < PickSuccessResult < Parameters < R [ T ] > [ 0 ] > > ( host , api as string , params ) ; } , mycall : async function mycall < R , P = Record < string , any > > ( host , api , params ? ) : Promise < R > { return mockServer < R > ( host , api as string , params ) ; } , ap : async function ap < T extends keyof R , R extends Record < string , Fn > = APBridgeMethods > ( host , api , params ? ) : Promise < PickSuccessResult < Parameters < R [ T ] > [ 0 ] > > { return mockServer < PickSuccessResult < Parameters < R [ T ] > [ 0 ] > > ( host , api as string , params ) ; } , } ;