Skip to content

Commit f687656

Browse files
author
John Vilk
committed
Properly mark optional parameters to functions.
1 parent d0bc904 commit f687656

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

generate/lib/write_ts_declarations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ var writeTsDecls = function(apiData, path) {
148148
jsDoc += param.description.replace(/\n/g, '\n ') + "\n";
149149
}
150150
// Make each param type a union type if multiple types.
151-
return paramName + ": " + (param.types.map(function(type) { return getType(type); }).join(" | "));
151+
return paramName + (param.optional ? "?" : "") + ": " + (param.types.map(function(type) { return getType(type); }).join(" | "));
152152
}).join(', ') + "): ";
153153

154154
var returnType = fcn.return ? getType(fcn.return.type) : "void";

0 commit comments

Comments
 (0)