better-typescript-lib icon indicating copy to clipboard operation
better-typescript-lib copied to clipboard

Issue when using `object` with `Object.entries` and `Object.values`

Open ehoogeveen-medweb opened this issue 9 months ago • 3 comments

TS Playground

As shown above, this overload included in better-typescript-lib cause an issue when applied to an object without a specified key or value type. The overload seems to match too eagerly, returning a type with never instead of falling through to the more generic call signatures.

Here's one way to fix it, although I don't know if it's the best fix: TS Playground

The same fix seems to work for Object.entries as well.

Note: This issue is unrelated to https://github.com/uhyo/better-typescript-lib/pull/31 (but maybe worth mentioning there)

ehoogeveen-medweb avatar May 13 '24 15:05 ehoogeveen-medweb