Code Monkey home page Code Monkey logo

Comments (14)

YuriGor avatar YuriGor commented on August 27, 2024 8

Looks like I am going to get back to this.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024 7

Brief progress report, just to let people know it's not abandoned:

I decided to create type definitions files right in the sources of package.
For testing my type definitions I rely on builtin VS Code autocompletion/hint feature, which works with *d.ts files out of the box. Later I'll add some typescript linter.

And finally, I hope some ts dev will give some feedback does it works as expected because I will not be able to write typescript tests for it.

I am still trying to avoid learning typescript, but only definitions.
(I have nothing against TS, looks very interesting, but I have absolutely no time for it)

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024 5

If anybody - let me know. Closed for now, maybe later I'll find some time for this.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024 3

Ok, v4.5.5 now has type definitions.

All the entry points covered in deepdash-es package,
but only with main 'deepdash' function definitions work in cjs "deepdash" package
(not with cherry-picked methods, standalone version etc).

This is because "types" property of package.json can be set with a single value only and ts does no assumptions about other modules, even if ...d.ts files mirror all the file names.

I implemented these definitions relying on VS Code only.
I am still not a TS guy, so please anybody give some feedback if it works or something broken.

from deepdash.

gwsbhqt avatar gwsbhqt commented on August 27, 2024 2

Many thanks for your efforts

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024 1

Ok, I found a minute for this, please check fixed v5.0.2

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

I have no resources to invest in learning TypeScript but without it, I'll not be able to do this task well.
If anybody wants to do it - I'll be happy to help.

from deepdash.

xumx avatar xumx commented on August 27, 2024

Thanks for the effort. I'm trying to use mapDeep in Typescript.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

Hi, in few days I am gonna publish first full version of definitions, it already works for vscode autocompletion, but only if I pollute root directory.

How do you use it?
deepdash or deepdash-es package?
Mixin everything into lodash, add only selected methods, use standalone version?

When I try to move definitions to separate directory and set "types" property of package.json - only this particular entry point works, but not all this cherry-picked separate methods.

As I got from internets, only more or less nice way to not pollute root directory is to copy this definitions only on npm install phase.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

If something - let me know here in comments, closing for now.

from deepdash.

jwhitmarsh avatar jwhitmarsh commented on August 27, 2024

@YuriGor firstly thank you for this excellent library! Secondly, thank you for doing the TS defs!

I've just come accross an issue using filterDeep where the options expects cloneDeep to be set. Looking at the docs this looks like it defaults to use lodash.cloneDeep so it's not a required property. If that's true, I think the type def should be

options?: {
    pathFormat?: "string" | "array"; // = "string";
    checkCircular?: boolean; // = false;
    keepCircular?: boolean; // = false;
    childrenPath?: Path[];
    includeRoot?: boolean;
    leavesOnly?: boolean; // = false;
    rootIsChildren?: boolean;
    callbackAfterIterate?: boolean; // = false;
    replaceCircularBy?: any;
    condense?: boolean;
    cloneDeep?: (value: any) => any; // <-- CHANGE HERE TO BE OPTIONAL
    onTrue?: {
      skipChildren?: boolean;
      cloneDeep?: boolean;
      keepIfEmpty?: boolean;
    };
    onFalse?: {
      skipChildren?: boolean;
      cloneDeep?: boolean;
      keepIfEmpty?: boolean;
    };
    onUndefined?: {
      skipChildren?: boolean;
      cloneDeep?: boolean;
      keepIfEmpty?: boolean;
    };
  }

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

HI @jwhitmarsh, thank you!
Yes, you are right, all the options always should be optional.
I see the same issue in the definitions of other methods where such an option exists,
so probably it was just copypasted by me everywhere.

I am not sure when I'll fix it, no time currently,
so if you have some free time - PR is welcome.

To do it just fork/clone repo, fix ts files in src folder and do npm test - it will rebuild everything (=copy ts files to es folder in this case)

from deepdash.

arash-bizcover avatar arash-bizcover commented on August 27, 2024

@YuriGor was this done already? I couldn't make it to show up in vscode autocomplete like regular lodash functions.

from deepdash.

YuriGor avatar YuriGor commented on August 27, 2024

Hi, @arash-bizcover it was working at that moment, maybe something was changed in vscode or was broken later.
I don't use vscode and typescript and have no time to check even bug listed in issues,
so if you have some time/energy to spend on this - contributions are welcome.

from deepdash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.