deno.land / x / rambda@v9.1.1 / source / forEach-spec.ts

forEach-spec.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {forEach} from 'rambda'
const list = [1, 2, 3]const obj = {a: 1, b: 2}
describe('R.forEach with arrays', () => { it('happy', () => { const result = forEach(a => { a // $ExpectType number }, list) result // $ExpectType number[] }) it('curried require an explicit typing', () => { const result = forEach<number>(a => { a // $ExpectType number })(list) result // $ExpectType number[] })})
describe('R.forEach with objects', () => { it('happy', () => { const result = forEach((a, b, c) => { a // $ExpectType number b // $ExpectType string c // $ExpectType Dictionary<number> return `${a}` }, obj) result // $ExpectType Dictionary<number> }) it('curried require an input typing and a dummy third typing', () => { // Required in order all typings to work const result = forEach<number, any>((a, b, c) => { a // $ExpectType number b // $ExpectType string c // $ExpectType Dictionary<number> })(obj) result // $ExpectType Dictionary<number> }) it('iterator without property', () => { const result = forEach(a => { a // $ExpectType number }, obj) result // $ExpectType Dictionary<number> })})
rambda

Version Info

Tagged at
2 months ago