Skip to content

Commit

Permalink
Make extra parameters optional for JS/TS backends (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
rogebrd committed May 6, 2021
1 parent 0167584 commit 1883c85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stone/backends/js_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _generate_struct(self, struct_type, extra_parameters=None, nameOverride=None
for param_name, param_type, param_docstring in extra_parameters:
param_docstring = ' - %s' % param_docstring if param_docstring else ''
self.emit_wrapped_text(
'@property {%s} %s%s' % (
'@property {%s} [%s]%s' % (
param_type,
param_name,
param_docstring,
Expand Down
3 changes: 2 additions & 1 deletion stone/backends/tsd_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ def _generate_struct_type(self, struct_type, indent_spaces, extra_parameters):
for param_name, param_type, param_docstring in extra_parameters:
if param_docstring:
self._emit_tsdoc_header(param_docstring)
self.emit('%s: %s;' % (param_name, param_type))
# Making all extra args optional parameters
self.emit('%s?: %s;' % (param_name, param_type))

for field in struct_type.fields:
doc = field.doc
Expand Down

0 comments on commit 1883c85

Please sign in to comment.