From 649d492bb4f8a6b41d70afd71875a6244c57f1e2 Mon Sep 17 00:00:00 2001 From: gigobyte Date: Sun, 7 Jul 2024 16:01:01 +0300 Subject: [PATCH] Const enums are bad in libraries, rewrite Order --- src/Function.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Function.ts b/src/Function.ts index d394f270..b3528ff4 100644 --- a/src/Function.ts +++ b/src/Function.ts @@ -7,11 +7,13 @@ export const always = () => x -export const enum Order { - LT = 'LT', - EQ = 'EQ', - GT = 'GT' -} +export const Order = { + LT: 'LT', + EQ: 'EQ', + GT: 'GT' +} as const + +export type Order = 'LT' | 'EQ' | 'GT' /** Compares two values using the default "<" and ">" operators */ export const compare = (x: T, y: T): Order => { @@ -47,8 +49,8 @@ export type CurriedFn = < ) => TProvidedArgs extends TAllArgs ? TReturn : TAllArgs extends [...TupleOfLength, ...infer TRestOfArgs] - ? CurriedFn - : never + ? CurriedFn + : never /** Takes a function that receives multiple arguments and returns a "curried" version of that function that can take any number of those arguments and if they are less than needed a new function that takes the rest of them will be returned */ export const curry = (