1
0
Эх сурвалжийг харах

fix: LooseUnion object typing

Sven 1 жил өмнө
parent
commit
c410c1704a
1 өөрчлөгдсөн 8 нэмэгдсэн , 3 устгасан
  1. 8 3
      lib/misc.ts

+ 8 - 3
lib/misc.ts

@@ -10,9 +10,14 @@ export type LooseUnion<TUnion extends string | number | object> =
     TUnion extends string
       ? (string & {})
       : (
-        TUnion extends object
-          ? (object & {})
-          : (number & {})
+        TUnion extends number
+          ? (number & {})
+          : (
+            // eslint-disable-next-line @typescript-eslint/no-explicit-any
+            TUnion extends Record<keyof any, unknown>
+            ? (object & {})
+            : never
+          )
       )
   );