-
Notifications
You must be signed in to change notification settings - Fork 30.6k
[lodash] Unable to map over a partition in a chain #46377
Copy link
Copy link
Closed
Description
interface Person {
name: string;
age: number;
}
declare let people: Person[];
const [evens, odds] = _(people)
.partition(p => p.age % 2 === 0)
.map(parityPeople => parityPeople.map(p => p.name))
// ~~~ Property 'map' does not exist on type 'LoDashImplicitWrapper<[Person[], Person[]]>'.
.value();This code runs fine but fails to type check. Mapping over an unwrapped tuple type using the native map is fine:
const [evens, odds] = _(people)
.partition(p => p.age % 2 === 0)
.value()
.map(parityPeople => parityPeople.map(p => p.name)); // ok- I tried using the
@types/lodashpackage and had problems. - I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
- Mention the authors (see
Definitions by:inindex.d.ts) so they can respond.- Authors: @WilliamChelman @DomiR @aj-r
If you do not mention the authors the issue will be ignored.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels