From f8b415a2fc2d1b1eff19333600a010bcaaebf890 Mon Sep 17 00:00:00 2001 From: David Fox Date: Wed, 22 Feb 2017 18:04:14 -0600 Subject: [PATCH] Mark optional fields as possibly being undefined --- cli/targets/static.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/targets/static.js b/cli/targets/static.js index 10b0e9756..d2ecf82e0 100644 --- a/cli/targets/static.js +++ b/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([