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

pickAll-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
48
49
50
51
52
import {pickAll} from 'rambda'
interface Input { a: string, b: number, c: number, d: number,}interface Output { a?: string, c?: number,}const input = {a: 'foo', b: 2, c: 3, d: 4}
describe('R.pickAll with array as props input', () => { it('without passing type', () => { const result = pickAll(['a', 'c'], input) result.a // $ExpectType string result.c // $ExpectType number }) it('without passing type + curry', () => { const result = pickAll(['a', 'c'])(input) result // $ExpectType unknown }) it('explicitly passing types', () => { const result = pickAll<Input, Output>(['a', 'c'], input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined })})
describe('R.pickAll with string as props input', () => { it('without passing type', () => { const result = pickAll('a,c', input) result // $ExpectType unknown }) it('without passing type + curry', () => { const result = pickAll('a,c')(input) result // $ExpectType unknown }) it('explicitly passing types', () => { const result = pickAll<Input, Output>('a,c', input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined }) it('explicitly passing types + curry', () => { const result = pickAll<Input, Output>('a,c')(input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined })})
rambda

Version Info

Tagged at
2 months ago