-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b658d8
commit 4e3cf57
Showing
5 changed files
with
27 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import {mapIndexed} from 'rambda' | ||
import {mapIndexed, piped} from 'rambda' | ||
|
||
const fn = (x: number, i: number) => { | ||
x // $ExpectType number | ||
i // $ExpectType number | ||
return x + 2 | ||
} | ||
const list = [1, 2, 3] | ||
|
||
describe('R.mapIndexed', () => { | ||
it('happy', () => { | ||
const result = mapIndexed<number>(fn, list) | ||
const result = mapIndexed(fn, list) | ||
result // $ExpectType number[] | ||
}) | ||
it('curried', () => { | ||
const result = mapIndexed<number>(fn)(list) | ||
result // $ExpectType number[] | ||
it('inside piped', () => { | ||
const result = piped( | ||
list, | ||
mapIndexed(fn), | ||
) | ||
result // $ExpectType number[] | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters