mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
typescript: all boolean parameters can be 0 / 1
This commit is contained in:
parent
133933b82a
commit
a23d4142d8
@ -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 ? "[]" : "")
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user