diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index aa84cad395..dab9a8d0e4 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for ramda // Project: https://github.com/donnut/typescript-ramda -// Definitions by: Erwin Poeze +// Definitions by: Erwin Poeze , Matt DeKrey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var R: R.Static; @@ -1402,8 +1402,8 @@ declare namespace R { /** * Sorts the list according to a key generated by the supplied function. */ - sortBy(fn: (a: any) => string, list: T[]): T[]; - sortBy(fn: (a: any) => string): (list: T[]) => T[]; + sortBy(fn: (a: any) => Ord, list: T[]): T[]; + sortBy(fn: (a: any) => Ord): (list: T[]) => T[]; /** * Splits a string into an array of strings based on the given diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 13aeb222f7..b7465e1773 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1617,6 +1617,24 @@ matchPhrases(['foo', 'bar', 'baz']); R.path(testPath)(testObj); //=> 2 } +() => { + var sortByAgeDescending = R.sortBy(R.compose(R.negate, R.prop('age'))); + var alice = { + name: 'ALICE', + age: 101 + }; + var bob = { + name: 'Bob', + age: -10 + }; + var clara = { + name: 'clara', + age: 314.159 + }; + var people = [clara, bob, alice]; + sortByAgeDescending(people); //=> [alice, bob, clara] +} + () => { var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name'))); var alice = {