Skip to content

Commit 22b4060

Browse files
committed
Fix modular template to always generate class property syntax
The modular template was incorrectly using object method syntax (`:` and `,`) when route.namespace was present, introduced by PR #1326. This caused TypeScript syntax errors in generated code. The modular template should always generate class properties with arrow functions (`=` and `;`), regardless of namespace presence. This resolves the issue reported in #1366 where version 13.2.8 generated invalid TypeScript code with modular templates. Signed-off-by: Sora Morimoto <[email protected]>
1 parent 078f3a0 commit 22b4060

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/modular/procedure-call.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const isValidIdentifier = (name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
9090
<%~ routeDocs.lines %>
9191

9292
*/
93-
<% if (isValidIdentifier(route.routeName.usage)) { %><%~ route.routeName.usage %><%~ route.namespace ? ': ' : ' = ' %><% } else { %>"<%~ route.routeName.usage %>"<%~ route.namespace ? ': ' : ' = ' %><% } %>(<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> =>
93+
<% if (isValidIdentifier(route.routeName.usage)) { %><%~ route.routeName.usage %><% } else { %>"<%~ route.routeName.usage %>"<% } %> = (<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> =>
9494
<%~ config.singleHttpClient ? 'this.http.request' : 'this.request' %><<%~ type %>, <%~ errorType %>>({
9595
path: `<%~ path %>`,
9696
method: '<%~ _.upperCase(method) %>',
@@ -100,4 +100,4 @@ const isValidIdentifier = (name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
100100
<%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %>
101101
<%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
102102
...<%~ _.get(requestConfigParam, "name") %>,
103-
})<%~ route.namespace ? ',' : '' %>
103+
})

0 commit comments

Comments
 (0)