shallow-equal icon indicating copy to clipboard operation
shallow-equal copied to clipboard

TS support

Open slorber opened this issue 5 years ago • 2 comments

That would be cool to ship TS defs for this package ;)

slorber avatar Nov 20 '19 16:11 slorber

Since the PR mentioned above has just been left to dry I've created my own small declaration. It's probably incorrect or missing parts but it covers the core functionality for me. Just sharing here in case anyone else wants to use it.

declare module "shallow-equal" {
  type primitives =
    | string
    | number
    | boolean
    | bigint
    | undefined
    | symbol
    | null;
  export function shallowEqualArrays(arr1: primitives[], arr2: primitives[]);

  interface primitiveObject {
    [key: string]: primitives;
  }
  export function shallowEqualObjects(
    obj1: primitiveObject,
    obj2: primitiveObject
  );
}

silverlight513 avatar Sep 09 '20 08:09 silverlight513

In this day and age with a PR ready to go that is ignored. Packages like this waste people's time.

rhyek avatar Apr 24 '21 15:04 rhyek

@slorber @silverlight513 @rhyek : I'm three years late to the party, but seeing as PRs aren't being taken in this repo, I've forked the codebase, implemented typescript, added tests as well as a generic shallowEqual, and have launched it as shallow-equal-modern.

I do plan to support and maintain that.

fivecar avatar Jan 11 '23 01:01 fivecar

I'm sorry guys. I really struggle with time. If anyone in interested to continue maintaining this package, please react out on Twitter.

moroshko avatar Jan 11 '23 08:01 moroshko

@moroshko : DM sent. Happy to help maintain/support this package, and remove my fork.

fivecar avatar Jan 11 '23 15:01 fivecar

Ok - @moroshko and I have now published v3.0.0, which supports Typescript.

fivecar avatar Jan 26 '23 02:01 fivecar