Update to new types

pull/2054/head
qucchia 2022-07-20 17:57:03 +02:00
parent cbd6e7d7f8
commit 1d400aa8a7
2 changed files with 2988 additions and 435 deletions

View File

@ -97,24 +97,24 @@ function get(key, obj, isGlobal) {
return pair.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(
`${indent ? "" : "declare "}function ${key}(${args}): ${returnType};`
);
} else {
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 {
if (hasProperties) {
add(`${indent ? "" : "declare "}const ${key}: ${getType(type)} & {`);

File diff suppressed because it is too large Load Diff