deno.land / x / froebel@v0.23.2 / truthy.test.ts

truthy.test.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
import { falsy, truthy } from "./truthy.ts";import { assertEquals } from "testing/asserts.ts";
Deno.test("truthy & falsy", () => { type Num = 0 | 1 | 2;
{ const num: Num = 2 as any;
assertEquals(truthy(num), true); assertEquals(falsy(num), false);
if (truthy(num)) { // @ts-expect-error const _nf: 0 = num; const _nt: 1 | 2 = num; } else { const _nf: 0 = num; // @ts-expect-error const _nt: 1 | 2 = num; }
if (falsy(num)) { const _nf: 0 = num; // @ts-expect-error const _nt: 1 | 2 = num; } else { // @ts-expect-error const _nf: 0 = num; const _nt: 1 | 2 = num; } }});
froebel

Version Info

Tagged at
a year ago