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

return type of findDeep should be optional #81

Closed casamia918 closed 3 years ago

casamia918 commented 3 years ago

// findDeep.d.ts

export default function findDeep(
  obj: any,
  callback?: (
    value: any,
    key: string | number,
    parentValue: any,
    context: IIterateeContext
  ) => void | boolean,
  options?: {
    pathFormat?: "string" | "array"; // = "string";
    checkCircular?: boolean; // = false;
    childrenPath?: Path[];
    includeRoot?: boolean;
    leavesOnly?: boolean; // = false;
    rootIsChildren?: boolean;
  }
): IDeepEntry;

In findDeep, return type is defined as IDeepEntry. But it should be optional, when no value is found.

At now, I only use findDeep method. So, I don't know how many methods should be modified in this library.

So, I just leave this comment, not PR

Thanks for create this library.

YuriGor commented 3 years ago

Hi, thank you! Feel free to create as much small PRs as you want whenever you found something wrong in types. I am not familiar with typescript, so it would be great to have fix suggestions from someone who is using it.

casamia918 commented 3 years ago

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

YuriGor commented 3 years ago

Thank you for PR, merged and will be published soon.