Skip to content

Commit

Permalink
fix: add optional param for typescript
Browse files Browse the repository at this point in the history
fixes: #48
  • Loading branch information
BelfordZ committed Jun 13, 2019
1 parent 90e6e22 commit 9c250b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const getMethodTyping = (method: MethodObject): string => {

const params = _.map(
method.params as ContentDescriptorObject[],
(param) => `${param.name}: ${getSchemaTypeName(param.schema)}`,
(param) => `${param.name}${param.required ? "" : "?"}: ${getSchemaTypeName(param.schema)}`,
).join(", ");

return `export type ${methodAliasName} = (${params}) => ${resultTypeName};`;
Expand Down

0 comments on commit 9c250b6

Please sign in to comment.