mobily / ts-belt

🔧 Fast, modern, and practical utility library for FP in TypeScript.
https://mobily.github.io/ts-belt
MIT License
1.11k stars 31 forks source link

D.keys type is correct for object with numeric indexes #46

Closed Nodonisko closed 2 years ago

Nodonisko commented 2 years ago

D.keys type is incorrect:

const keys = D.keys({ 1: 'ahoj', 2: 'ahoj2' });
console.log(keys);

This will print [ '1', '2' ] but type for keys is readonly (1 | 2)[] which is wrong because it shouldn't be numbers but strings: readonly ('1' | '2')[]

Nodonisko commented 2 years ago

It's probably related to this https://github.com/microsoft/TypeScript/issues/39543