Skip to content

Commit

Permalink
Mark optional fields as possibly being undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
foxdavidj committed Feb 23, 2017
1 parent 2ddb76b commit f8b415a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function buildFunction(type, functionName, gen, scope) {

if (config.beautify)
code = beautifyCode(code);

code = code.replace(/ {4}/g, "\t");

var hasScope = scope && Object.keys(scope).length;
Expand Down Expand Up @@ -307,7 +307,7 @@ function buildType(ref, type) {
pushComment([
field.comment || type.name + " " + field.name + ".",
prop.charAt(0) !== "." ? "@name " + fullName + "#" + field.name : null,
"@type {" + jsType + "}"
"@type {" + jsType + (field.optional ? "|undefined": "") + "}"
]);
} else if (firstField) {
push("");
Expand Down Expand Up @@ -389,7 +389,7 @@ function buildType(ref, type) {
--indent;
push("};");
}

if (config.encode) {
push("");
pushComment([
Expand Down

0 comments on commit f8b415a

Please sign in to comment.