simontonsoftware / s-libs

A collection of libraries for any of javascript, rxjs, or angular.
MIT License
43 stars 5 forks source link

[micro-dash] Readonly Array types #36

Closed luhis closed 3 years ago

luhis commented 3 years ago

Hi,

I was using your library today and I ran into a minor issue, non mutating functions aren't using readonly array types.

Take sumBy for instance: https://github.com/simontonsoftware/s-libs/blob/master/projects/micro-dash/src/lib/math/sum-by.ts i cannot pass in a readonly number[] (previously written as ReadonlyArray<number>), so I have to cast my input into number[] to pass the type checker. chunkBy, and uniqBy have the same problem, and there must be many others.

the readonly keyword is quite new, but ReadonlyArray has been around since TypeScript 2 and they are the 100% same thing, and i see that ReadonlyArray is already used in a few places.

Sorry to not give you a PR, I'm having issues with running the tests here.

ersimont commented 3 years ago

This is a good thought. Thank you for raising the issue. I will keep this high on my TODO list.

ersimont commented 3 years ago

I'll take a look at this later tonight in my live stream on Twitch :). https://www.twitch.tv/ersimont