From ebd1caf6d19583ece0e6795a109bc38fa7ce6b5b Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Wed, 17 Nov 2021 15:50:04 +0530 Subject: [PATCH] Convert enum.js to ts --- src/utils/{enum.js => enum.ts} | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) rename src/utils/{enum.js => enum.ts} (80%) diff --git a/src/utils/enum.js b/src/utils/enum.ts similarity index 80% rename from src/utils/enum.js rename to src/utils/enum.ts index 4defcfd7..71365984 100644 --- a/src/utils/enum.js +++ b/src/utils/enum.ts @@ -14,12 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -export function createEnum(...values) { +export function createEnum(...values: string[]): Readonly<{}> { const obj = {}; for (const value of values) { - if (typeof value !== "string") { - throw new Error("Invalid enum value name" + value?.toString()); - } obj[value] = value; } return Object.freeze(obj);