Skip to content

Commit

Permalink
fix: Define properly modules
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Apr 8, 2024
1 parent e5119f7 commit 146aca3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/metadataProvider/createPseudoModulesInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,27 @@ async function addOverrides(enums: Record<string, UI5Enum[]>) {

for (const libName of Object.keys(enums)) {
const enumEntries = enums[libName];
const stringBuilder: string[] = [];

const stringBuilder: string[] = [
`declare module "${libName.replaceAll(".", "/")}/library" {`,
];
enumEntries.forEach((enumEntry) => {
if (enumEntry.kind !== "UI5Enum") {
return;
}

stringBuilder.push(`declare module "${libName.replaceAll(".", "/")}/${enumEntry.name}" {`);
stringBuilder.push("");
stringBuilder.push(buildJSDoc(enumEntry, "\t"));
stringBuilder.push(`\texport enum ${enumEntry.name} {`);
enumEntry.fields.forEach((value) => {
stringBuilder.push(buildJSDoc(value, "\t\t"));
stringBuilder.push(`\t\t${value.name} = "${value.name}",`);
});
stringBuilder.push(`\t}`);
stringBuilder.push(`}`);
stringBuilder.push("");

return stringBuilder.join("\n");
});
stringBuilder.push(`}`);

indexFilesImports.push(`import "./${libName}";`);
await writeFile(
Expand Down

0 comments on commit 146aca3

Please sign in to comment.