YuriGor / deepdash

eachDeep, filterDeep, findDeep, someDeep, omitDeep, pickDeep, keysDeep etc.. Tree traversal library written in Underscore/Lodash fashion
https://deepdash.io/
MIT License
272 stars 12 forks source link

findDeep return types problem #84

Closed casamia918 closed 3 years ago

casamia918 commented 3 years ago
export interface IDeepEntry {
  value: any;
  key?: string | number;
  path?: Path;
  parent?: IDeepEntry;
  /**
   * contains matched childrenPath path of this parent node, chosen from childrenPath array, if it was specified.
   */
  childrenPath?: Path;
}

For now, IDeepEntry interface is defined as above. But it has no context field. Which should be IIterateeContext Also, the type of parent field is defined as IDeepEntry. But when I call findDeep, type of returnedObj.parent is not IDeepEntry (it is parent.value obj)

casamia918 commented 3 years ago

https://github.com/YuriGor/deepdash/pull/85

YuriGor commented 3 years ago

Actually there is a real issue with types here, findDeep return type should not be IDeepEntry, but a separate type.

YuriGor commented 3 years ago

I have no time and very low motivation for this issue, because I am not using TS. For the same reason it's difficult for me to develop TS-related stuff. So if someone from TS world have free time to take a look at this issue - PR is very welcome.