Skip to content

Commit f12a03f

Browse files
committed
js: change constants from enum to namespace to fix type issues
1 parent 72bd9d0 commit f12a03f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

deltachat-jsonrpc/typescript/scripts/generate-constants.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,25 @@ const constants = data
4545
);
4646
})
4747
.map((row) => {
48-
return ` ${row.key} = ${row.value}`;
48+
return ` export const ${row.key} = ${row.value};`;
4949
})
50-
.join(",\n");
50+
.join("\n");
5151

5252
writeFileSync(
5353
resolve(__dirname, "../generated/constants.ts"),
5454
`// Generated!
5555
56-
export enum C {
57-
${constants},
56+
export namespace C {
57+
${constants}
5858
/** @deprecated 10-8-2025 compare string directly with \`== "Group"\` */
59-
DC_CHAT_TYPE_GROUP = "Group",
59+
export const DC_CHAT_TYPE_GROUP = "Group";
6060
/** @deprecated 10-8-2025 compare string directly with \`== "InBroadcast"\`*/
61-
DC_CHAT_TYPE_IN_BROADCAST = "InBroadcast",
61+
export const DC_CHAT_TYPE_IN_BROADCAST = "InBroadcast";
6262
/** @deprecated 10-8-2025 compare string directly with \`== "Mailinglist"\` */
63-
DC_CHAT_TYPE_MAILINGLIST = "Mailinglist",
63+
export const DC_CHAT_TYPE_MAILINGLIST = "Mailinglist";
6464
/** @deprecated 10-8-2025 compare string directly with \`== "OutBroadcast"\` */
65-
DC_CHAT_TYPE_OUT_BROADCAST = "OutBroadcast",
65+
export const DC_CHAT_TYPE_OUT_BROADCAST = "OutBroadcast";
6666
/** @deprecated 10-8-2025 compare string directly with \`== "Single"\` */
67-
DC_CHAT_TYPE_SINGLE = "Single",
67+
export const DC_CHAT_TYPE_SINGLE = "Single";
6868
}\n`,
6969
);

0 commit comments

Comments
 (0)