From fe4df00abcd88585dc3249acb01633e67c2e7969 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Thu, 27 Jun 2024 16:11:35 +0200 Subject: [PATCH] Declarations - const enum to enums (#15235) --- packages/dev/buildTools/src/generateDeclaration.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/dev/buildTools/src/generateDeclaration.ts b/packages/dev/buildTools/src/generateDeclaration.ts index 897d194775d..5dbcdadba78 100644 --- a/packages/dev/buildTools/src/generateDeclaration.ts +++ b/packages/dev/buildTools/src/generateDeclaration.ts @@ -168,7 +168,8 @@ function getModuleDeclaration( return; } }); - processedLines = processedLines.replace(/export declare /g, "export "); + processedLines = processedLines.replace(/export declare /g, "export ").replace(/export const enum/g, "export enum"); + return `declare module "${moduleName}" { ${processedLines} } @@ -399,6 +400,8 @@ function getPackageDeclaration( } ); + processedSource = processedSource.replace(/export const enum/g, "export enum"); + processedSource = processedSource.replace( / global {([^}]*)}/gm, `