fix(types): better types for TypedRouter.routeAndAddResponse
This commit is contained in:
parent
9a07817914
commit
ea56e2218f
@ -21,7 +21,7 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
|
|||||||
public method: string;
|
public method: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* note the overloading is thought to deak with promises
|
* note the overloading is thought to deal with promises
|
||||||
* @param postEndPointArg
|
* @param postEndPointArg
|
||||||
* @param methodArg
|
* @param methodArg
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +91,7 @@ export class TypedRouter {
|
|||||||
* if typedrequest object has correlation.phase === 'response' -> routes a typed request object to request fire event
|
* if typedrequest object has correlation.phase === 'response' -> routes a typed request object to request fire event
|
||||||
* @param typedRequestArg
|
* @param typedRequestArg
|
||||||
*/
|
*/
|
||||||
public async routeAndAddResponse(typedRequestArg: plugins.typedRequestInterfaces.ITypedRequest) {
|
public async routeAndAddResponse<T extends plugins.typedRequestInterfaces.ITypedRequest = any>(typedRequestArg: T) {
|
||||||
if (!typedRequestArg?.correlation?.phase || typedRequestArg.correlation.phase === 'request') {
|
if (!typedRequestArg?.correlation?.phase || typedRequestArg.correlation.phase === 'request') {
|
||||||
const typedHandler = this.getTypedHandlerForMethod(typedRequestArg.method);
|
const typedHandler = this.getTypedHandlerForMethod(typedRequestArg.method);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ export type IPostMethod = (
|
|||||||
) => Promise<plugins.typedRequestInterfaces.ITypedRequest>;
|
) => Promise<plugins.typedRequestInterfaces.ITypedRequest>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* this is an alternative to a post url supplied in `new Typedrequest(new TypedTarget(...), 'someMethodName')`
|
||||||
* enables the use of custom post functions
|
* enables the use of custom post functions
|
||||||
* used for things like broadcast channels
|
* used for things like broadcast channels
|
||||||
* e.g. @designestate/dees-comms
|
* e.g. @designestate/dees-comms
|
||||||
|
Loading…
Reference in New Issue
Block a user