Skip to content

Commit e206182

Browse files
authored
Merge pull request #2568 from bobrippling/types/short-bool
typescript: all boolean parameters can be `0` / `1`
2 parents b954a9f + a23d414 commit e206182

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/build_types.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ function getDocumentation(object) {
103103
* @param {string} type - The basic type.
104104
* @returns {string} The TypeScript type.
105105
*/
106-
function getBasicType(type) {
106+
function getBasicType(type, isParam) {
107107
if (!type) return "any";
108108
if (["int", "float", "int32"].includes(type)) return "number";
109109
if (type == "pin") return "Pin";
110110
if (type == "String") return "string";
111-
if (type == "bool") return "boolean";
111+
if (type == "bool") return isParam ? "ShortBoolean" : "boolean";
112112
if (type == "JsVarArray") return "any";
113113
if (type == "JsVar") return "any";
114114
if (type == "Array") return "any[]";
@@ -138,7 +138,7 @@ function getArguments(method) {
138138
param[0] +
139139
(optional ? "?" : "") +
140140
": " +
141-
getBasicType(param[1]) +
141+
getBasicType(param[1], 1) +
142142
(rest ? "[]" : "")
143143
);
144144
});

0 commit comments

Comments
 (0)