Closed Peeja closed 1 year ago
Thanks for this PR.
I'd change few things before releasing:
Introducing TElement
/TNewElement
while correct in the context of R.append
deviates from the rest of types, so I will make it more generic.
I'll check again if change in R.zipObj
test is required.
Sounds good! I went with that sort of naming because I kept losing track of what was what otherwise, but please do adjust it as you see fit. 🙂
Before,
R.prepend(4)
orR.append(4)
would produce a function which could only be applied to anumber[]
. However, you may well want to append a4
to an array whose elements can benumber
s or other things, such as a(string | number)[]
. This commit improves the types to accept such arrays.You may also have an array of a more specific type (such as
number[]
) and wish to useR.prepend
/R.append
to expand the type. Because it's usually a mistake,append("d")(listOfNumbers)
will cause a type error; however, explicitly callingappend("d")<string | number>(listOfNumbers)
will give you a(string | number)[]
.