lodash-id icon indicating copy to clipboard operation
lodash-id copied to clipboard

Typescript support?

Open Augustin82 opened this issue 4 years ago • 2 comments

Hello, I couldn't find any Typescript support for this library, does it exist?

Many thanks!

Augustin82 avatar Jul 28 '20 07:07 Augustin82

any news on this ?

LoiKos avatar Oct 06 '20 14:10 LoiKos

I'm interested also. I'm obliged to cast db as any to modify the createId method:

    // add basic getById methods
    db._.mixin(lodashId);
    // add collection() methods to remove magic strings
    db._.mixin({
      collection: function(obj) { return obj['col']; }
    });
    // override defaults from lodashId
    (db._ as any).id = '_id';
    (db._ as any).createId = (collection: any, doc: any) => {
      return `${name}@${nanoid(10)}`;
    };

JR-Utily avatar Dec 26 '20 10:12 JR-Utily