mirror of https://github.com/espruino/BangleApps
Update to new types
parent
cbd6e7d7f8
commit
1d400aa8a7
|
@ -97,24 +97,24 @@ function get(key, obj, isGlobal) {
|
||||||
return pair.join(": ");
|
return pair.join(": ");
|
||||||
})
|
})
|
||||||
.join(", ");
|
.join(", ");
|
||||||
if (topLevel) {
|
|
||||||
|
if (hasProperties) {
|
||||||
|
add(`${indent ? "" : "declare "}const ${key}: {`);
|
||||||
|
indent += 2;
|
||||||
|
topLevel = false;
|
||||||
|
for (const key in obj) {
|
||||||
|
get(key, obj[key], true);
|
||||||
|
}
|
||||||
|
topLevel = true;
|
||||||
|
indent -= 2;
|
||||||
|
add("};");
|
||||||
|
} else if (topLevel) {
|
||||||
add(
|
add(
|
||||||
`${indent ? "" : "declare "}function ${key}(${args}): ${returnType};`
|
`${indent ? "" : "declare "}function ${key}(${args}): ${returnType};`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
add(`${key}: (${args}) => ${returnType};`);
|
add(`${key}: (${args}) => ${returnType};`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasProperties) {
|
|
||||||
add("");
|
|
||||||
add(`declare namespace ${key} {`);
|
|
||||||
indent += 2;
|
|
||||||
for (const key in obj) {
|
|
||||||
get(key, obj[key], true);
|
|
||||||
}
|
|
||||||
indent -= 2;
|
|
||||||
add("}");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (hasProperties) {
|
if (hasProperties) {
|
||||||
add(`${indent ? "" : "declare "}const ${key}: ${getType(type)} & {`);
|
add(`${indent ? "" : "declare "}const ${key}: ${getType(type)} & {`);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue