typed-typings/npm-lodash

Missing / Incorrect Definitions for Chainable first / last

Opened this issue · 3 comments

Was attempting to do something like the following:
let eventName = _.chain("X.Y:Z").split(":").first().split(".").last().value();

and receiving an error on "first".

Adding the following:
interface LoDashExplicitArrayWrapper<T> { first(): LoDashExplicitWrapper<T>; }

fixed it. This seems like a valid addition because there is a near similar definition for "last" which looks like:
interface LoDashExplicitArrayWrapper<T> { last(): T; }

The difference between the two being LoDashExplicitWrapper vs T.

So I changed last to also return LoDashExplicitWrapper and now the above works.

Thank you for this report: I agree that this is a missing declaration.
Since you were able to solve this issue, could you send a PR ?

Would one of you like to own this definition? /cc @types