Skip to content

Commit

Permalink
Merge c3ee38b into 00b2736
Browse files Browse the repository at this point in the history
  • Loading branch information
fpbouchard committed Feb 4, 2021
2 parents 00b2736 + c3ee38b commit 4196e16
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/integration.test.ts
Expand Up @@ -51,7 +51,7 @@ function createServer(spies: any) {
const classAPI = makeClassInvoker(TestClass)
router.get('/function', fnAPI('handle'))
router.get('/class', classAPI('handle'))
router.get('/fail', fnAPI('not a method'))
router.get('/fail', fnAPI('not a method' as any))
app.use(router)

return new Promise((resolve, reject) => {
Expand Down
5 changes: 3 additions & 2 deletions src/controller.ts
Expand Up @@ -5,7 +5,8 @@ import {
HttpVerbs,
getStateAndTarget,
IStateAndTarget,
IAwilixControllerBuilder
IAwilixControllerBuilder,
ClassOrFunctionReturning
} from 'awilix-router-core'
import { makeInvoker } from './invokers'
import { Router } from 'express'
Expand Down Expand Up @@ -83,7 +84,7 @@ function _registerController(
methodCfg.paths,
...methodCfg.beforeMiddleware,
/*tslint:disable-next-line*/
makeInvoker(target as any)(methodName),
makeInvoker(target as ClassOrFunctionReturning<any>)(methodName as any),
...methodCfg.afterMiddleware
)
})
Expand Down
3 changes: 1 addition & 2 deletions src/invokers.ts
Expand Up @@ -10,7 +10,6 @@ import {
} from 'awilix'
import { isClass } from 'awilix/lib/utils'
import { NextFunction, Request, Response } from 'express'
import { MethodName } from 'awilix-router-core'
import assert = require('assert')

/**
Expand Down Expand Up @@ -82,7 +81,7 @@ export function makeResolverInvoker<T>(resolver: Resolver<T>) {
* @param {MethodName} methodToInvoke
* @return {(req) => void}
*/
return function makeMemberInvoker(methodToInvoke: MethodName) {
return function makeMemberInvoker<K extends keyof T>(methodToInvoke: K) {
/**
* The invoker middleware.
*
Expand Down

0 comments on commit 4196e16

Please sign in to comment.