Skip to content

Commit

Permalink
typescript: all boolean parameters can be 0 / 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Oct 10, 2024
1 parent 133933b commit a23d414
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/build_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ function getDocumentation(object) {
* @param {string} type - The basic type.
* @returns {string} The TypeScript type.
*/
function getBasicType(type) {
function getBasicType(type, isParam) {
if (!type) return "any";
if (["int", "float", "int32"].includes(type)) return "number";
if (type == "pin") return "Pin";
if (type == "String") return "string";
if (type == "bool") return "boolean";
if (type == "bool") return isParam ? "ShortBoolean" : "boolean";
if (type == "JsVarArray") return "any";
if (type == "JsVar") return "any";
if (type == "Array") return "any[]";
Expand Down Expand Up @@ -138,7 +138,7 @@ function getArguments(method) {
param[0] +
(optional ? "?" : "") +
": " +
getBasicType(param[1]) +
getBasicType(param[1], 1) +
(rest ? "[]" : "")
);
});
Expand Down

0 comments on commit a23d414

Please sign in to comment.