From a23d4142d8cc657f7fbb9fc8fe669a40e018924b Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Thu, 10 Oct 2024 20:51:14 +0100 Subject: [PATCH] typescript: all boolean parameters can be `0` / `1` --- scripts/build_types.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build_types.js b/scripts/build_types.js index 83e549dfb2..400716ee61 100644 --- a/scripts/build_types.js +++ b/scripts/build_types.js @@ -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[]"; @@ -138,7 +138,7 @@ function getArguments(method) { param[0] + (optional ? "?" : "") + ": " + - getBasicType(param[1]) + + getBasicType(param[1], 1) + (rest ? "[]" : "") ); });