DefinitelyTyped/types/ramda
Mirone 3a53a5299b [ramda] add d.ts for ramda o function (#38963)
* add d.ts for ramda o function

* fix tslint

* fix tslint

* add my name

* fix for the last reload
2019-10-14 15:52:04 -07:00
..
es [ramda] add d.ts for ramda o function (#38963) 2019-10-14 15:52:04 -07:00
src [ramda] add d.ts for ramda o function (#38963) 2019-10-14 15:52:04 -07:00
test ramda: Add support for mapObjIndexed and string union key types (#38421) 2019-10-14 14:54:37 -07:00
index.d.ts [ramda] add d.ts for ramda o function (#38963) 2019-10-14 15:52:04 -07:00
package.json
ramda-tests.ts [ramda] add d.ts for ramda o function (#38963) 2019-10-14 15:52:04 -07:00
README.md
tools.d.ts
tsconfig.json [ramda] remove R.isArrayLike (#39084) 2019-10-14 10:49:23 -07:00
tslint.json

@types/ramda

Contributing

ramda is a popular library with a plethora of functions that can be mixed and matched in thousands of ways. Because of this, it can be a challenge to make changes to its types without breaking something. While sometimes breaking-changes are appropriate, we hope to keep them to a minimum.

Please read this guide in its entirety. Doing so helps ensure that the only breaking changes will be those that bring @types/ramda closer to representing the behavior of the underlying ramda package.

Tests

Tests are located in the test/ directory. Each ramda function has its own test file, named <function>-tests.ts. When editing types for a function, please update the corresponding tests to prove that the behavior you seek actually works. When adding a new function, add a corresponding test file with as many tests as you can to detail the function's behavior.

As a rule, the goal of each test file is to prove that the corresponding function's input and output types are correct. As such, each test file should only test its corresponding function as the top-most call.

For instance, the following:

R.pipe(
  R.add(2),
  R.add(3),
  R.add(4),
);

tests R.pipe, not R.add. So it belongs in test/pipe-tests.ts rather than test/map-tests.ts.

Use $ExpectType comments to test that a function returns the correct type:

// $ExpectType string[]
R.map((n: number) => n.toString(), [1, 2, 3]);

Use $ExpectError comments to test that using a function a certain way should result in a compiler error:

// $ExpectError
R.map((n: number) => n.toString(), ['1', '2', '3']);