Skip to content

Commit e7656f6

Browse files
committed
fix(code-gen): cast ctx to bodyParser call in Koa router
1 parent ce6f814 commit e7656f6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/code-gen/src/router/js-koa.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ type _Context = import("koa").ParameterizedContext<{}, {
369369
fileWrite(file, `ctx.request.params = params;`);
370370

371371
if (route.body || route.query) {
372-
fileWrite(file, `await bodyParser(ctx);`);
372+
if (file.relativePath.endsWith(".ts")) {
373+
fileWrite(file, `await bodyParser(ctx as any);`);
374+
} else {
375+
fileWrite(file, `await bodyParser(ctx);`);
376+
}
373377
}
374378

375379
if (route.params) {

0 commit comments

Comments
 (0)