-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Description
- I tried using the latest
lodash/lodash-3.10.d.tsfile in this repo and had problems. - I tried using the latest stable version of tsc. (1.8.9) https://www.npmjs.com/package/typescript
- I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
- [X ] I want to talk about
lodash/lodash-3.10.d.ts.
The authors of that type definition are @chrootsu, @vvakame
Hello and thanks for the d.ts file for lodash.
Unfortunately I don't get the following piece of code (simplified) to compile:
let collection = {
a: '1',
b: '2',
c: ''
};
_.some(collection, (value, key) => {
return false;
});=> Error:(186, 17) TS2345: Argument of type '{ a: string; b: string; c: string; }' is not assignable to parameter of type 'List<{}> | Dictionary<{}> | NumericDictionary<{}>'.
Type '{ a: string; b: string; c: string; }' is not assignable to type 'NumericDictionary<{}>'.
Index signature is missing in type '{ a: string; b: string; c: string; }'.
IMHO that should work according to their documentation (https://lodash.com/docs#some)
collection (Array|Object): The collection to iterate over.
The _.forEach method accepts an object (since it is declared as T extends {})
_.forEach(collection, (value, key) => {
// do something
});forEach<T extends {}, TValue>(
collection: T,
iteratee?: ObjectIterator<TValue, any>,
thisArgs?: any
): T;What is your opinion on that issue? Am I missing something?
Thanks for your help.
PS: I know that it used to compile with an very old version of the lodash.d.ts file (commitID: 9ce3cd4)