deno.land / x / rambda@v9.1.1 / source / head-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
import { emptyList, emptyString, mixedList, mixedListConst, numberList, numberListConst, string,} from '_internals/typescriptTestUtils'import {head, last} from 'rambda'
describe('R.head', () => { it('string', () => { head(string) // $ExpectType string last(string) // $ExpectType string }) it('empty string', () => { head(emptyString) // $ExpectType undefined last(emptyString) // $ExpectType undefined }) it('array', () => { head(numberList) // $ExpectType number head(numberListConst) // $ExpectType 1
last(numberList) // $ExpectType number last(numberListConst) // $ExpectType 3 }) it('empty array', () => { const list = [] as const head(emptyList) // $ExpectType undefined head(list) // $ExpectType never last(emptyList) // $ExpectType undefined last(list) // $ExpectType never })
it('mixed', () => { head(mixedList) // $ExpectType string | number head(mixedListConst) // $ExpectType 1 last(mixedList) // $ExpectType string | number last(mixedListConst) // $ExpectType "bar" })})
rambda

Version Info

Tagged at
2 months ago