merge icon indicating copy to clipboard operation
merge copied to clipboard

Typescript definitions

Open louy opened this issue 8 years ago • 6 comments

Hi,

I'd be great if you add a typescript definitions file. I've created one for you already.

declare module 'merge' {
  function merge<A extends Object>(a: A): A;
  function merge<A extends Object, B>(a: A, b: B): A & B;
  function merge<A extends Object, B, C>(a: A, b: B, c: C): A & B & C;
  function merge<A extends Object, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
  function merge<A extends Object, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E;

  function merge<A extends Object>(recursive: boolean, a: A): A;
  function merge<A extends Object, B>(recursive: boolean, a: A, b: B): A & B;
  function merge<A extends Object, B, C>(recursive: boolean, a: A, b: B, c: C): A & B & C;
  function merge<A extends Object, B, C, D>(recursive: boolean, a: A, b: B, c: C, d: D): A & B & C & D;
  function merge<A extends Object, B, C, D, E>(recursive: boolean, a: A, b: B, c: C, d: D, e: E): A & B & C & D & E;

  namespace merge {
    function recursive<A extends Object>(a: A): A;
    function recursive<A extends Object, B>(a: A, b: B): A & B;
    function recursive<A extends Object, B, C>(a: A, b: B, c: C): A & B & C;
    function recursive<A extends Object, B, C, D>(a: A, b: B, c: C, d: D): A & B & C & D;
    function recursive<A extends Object, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A & B & C & D & E;
  }

  export = merge;
}

You'd make my life much easier :)

louy avatar Dec 02 '15 15:12 louy

The type definitions should be included in a dedicated npm package, as recommended by the TypeScript team; that's now the way forward so that typings can be added as any other dependency to a project easily without necessarily requiring library releases for typings modifications (e.g., bug fixing)

dsebastien avatar Sep 15 '16 07:09 dsebastien

Could you please add a reference?

louy avatar Sep 20 '16 12:09 louy

It's described here: https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/

dsebastien avatar Sep 21 '16 20:09 dsebastien

So will the support for "typescript"?

fenixphp avatar Jul 16 '18 23:07 fenixphp

Any updates on types? The library seems to be updated to typescript with v2.0.0 but not published to npm.

renarsvilnis avatar Oct 21 '19 15:10 renarsvilnis

Yes and I'd like to use it for a project, but I don't want to have Github dependencies... So please publish the updated package to npm

Androz2091 avatar May 23 '20 12:05 Androz2091