Permalink
Browse files

Mark optional fields as possibly being undefined

  • Loading branch information...
obto committed Feb 23, 2017
1 parent 2ddb76b commit f8b415a2fc2d1b1eff19333600a010bcaaebf890
Showing with 3 additions and 3 deletions.
  1. +3 −3 cli/targets/static.js
@@ -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;
@@ -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("");
@@ -389,7 +389,7 @@ function buildType(ref, type) {
--indent;
push("};");
}
if (config.encode) {
push("");
pushComment([

0 comments on commit f8b415a

Please sign in to comment.