PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: marpple/FxTS (ts)

Issue:
feat: enhance entries type
# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## ⭐ Suggestion

<!-- What would you like to be added? -->

entries type is supported to fit more general situations.


## 💻 Use Cases

<!-- What do you want to use this for? -->

```ts
type Obj = {
  [key: string]: number;
};

const fn = (obj: Obj) => entries(obj);
const res1 = fn({ hello: 3 }); //  Generator<[string, number], void, unknown

const res2 = entries({ hello: 2 }); // Generator<["hello", number], void, unknown>


export const OsTypeEnum = {
  Android: `android`,
  Ios: `ios`,
  Windows: `windows`,
} as const;

export type OsTypeEnum = (typeof OsTypeEnum)[keyof typeof OsTypeEnum];
type Os = {
  [key in OsTypeEnum]: string;
};

const fn = (obj: Os) => entries(obj);
const res4 = fn({
  [OsTypeEnum.Android]: "Android",
  [OsTypeEnum.Ios]: "Ios",
  [OsTypeEnum.Windows]: "Windows",
  // only OsTypeEnum key
});


```



Pull request:
feat: enhance entries type
Fixes #230


Patch:
diff --git a/src/Lazy/entries.ts b/src/Lazy/entries.ts
index ec1d1699..302ddd7d 100644
--- a/src/Lazy/entries.ts
+++ b/src/Lazy/entries.ts
@@ -1,6 +1,7 @@
-type Entries<T extends Record<string, any>, K extends keyof T> = K extends any
-  ? [K, T[K]]
-  : never;
+type Entries<
+  T extends Record<string, any>,
+  K extends keyof T,
+> = K extends string ? [K, T[K]] : never;
 
 /**
  *


Test patch:
diff --git a/type-check/Lazy/entries.test.ts b/type-check/Lazy/entries.test.ts
index 8637ec4c..ae57dd87 100644
--- a/type-check/Lazy/entries.test.ts
+++ b/type-check/Lazy/entries.test.ts
@@ -15,6 +15,13 @@ const obj = {
 const res1 = entries(obj);
 const res2 = pipe(obj, entries);
 
+type Obj = {
+  [key: string]: number;
+};
+
+const fn = (obj: Obj) => entries(obj);
+const res3 = fn({ hello: 3 });
+
 checks([
   check<
     typeof res1,
@@ -42,4 +49,6 @@ checks([
     >,
     Test.Pass
   >(),
+
+  check<typeof res3, Generator<[string, number], void, unknown>, Test.Pass>(),
 ]);