Skip to content

Commit 1e774e9

Browse files
committed
refactor: use lazyload function name as the route reference
1 parent c1052ca commit 1e774e9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/router/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class Route<Controller extends Constructor<any> = any> extends Macroable
164164
* loads the controller
165165
*/
166166
return {
167-
reference: handler,
167+
reference: handler[0].name,
168168
...moduleImporter(handler[0], (handler[1] || 'handle') as string).toHandleMethod(),
169169
}
170170
}

tests/router/types.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { HttpContext } from '../../src/http_context/main.js'
1212
import { GetControllerHandlers } from '../../src/types/route.js'
1313

1414
test.group('Router types', () => {
15-
test('infer types for lazily imported router controller', ({ expectTypeOf }) => {
15+
test('infer route handlers from controller constructor', ({ expectTypeOf }) => {
1616
class HomeControllerClass {
1717
async index() {}
1818
async store({}: HttpContext) {}

0 commit comments

Comments
 (0)