Skip to content

Commit 6e603a8

Browse files
committed
chore: add undefined check in params
1 parent 92efa1b commit 6e603a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

templates/web/src/services/template.ts.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class {{ service.name | caseUcfirst }} {
6969
} else {
7070
params = {
7171
{%~ for parameter in method.parameters.all %}
72-
{{ parameter.name | caseCamel | escapeKeyword }}: {% if loop.index0 == 0 %}paramsOrFirst{% else %}rest[{{ loop.index0 - 1 }}]{% endif %} as {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %},
72+
{{ parameter.name | caseCamel | escapeKeyword }}: {% if loop.index0 == 0 %}paramsOrFirst{% else %}rest[{{ loop.index0 - 1 }}]{% endif %} as {{ parameter | getPropertyType(method) | raw }}{% if not parameter.required or parameter.nullable %} | undefined{% endif %}{% if not loop.last %},
7373
{% endif %}
7474
{%~ endfor %}
7575

@@ -82,6 +82,7 @@ export class {{ service.name | caseUcfirst }} {
8282
{%~ for parameter in method.parameters.all %}
8383
const {{ parameter.name | caseCamel | escapeKeyword }} = params.{{ parameter.name | caseCamel | escapeKeyword }};
8484
{%~ endfor %}
85+
8586
{%~ else %}
8687
{%~ if 'multipart/form-data' in method.consumes %}
8788
if (typeof paramsOrFirst === 'function') {

0 commit comments

Comments
 (0)