-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
UnpackEvt.ts
67 lines (35 loc) 路 836 Bytes
/
UnpackEvt.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
53
54
55
56
57
58
59
60
import type { UnpackEvt, Evt, EvtLike, StatefulEvt } from "../../lib/index.ts";
import { assert, Equals } from "https://deno.land/x/tsafe@v1.5.2/mod.ts";
{
type Got = UnpackEvt<Evt<string>>;
type Expected = string;
assert<Equals<Got, Expected>>();
}
{
type Got = UnpackEvt<Evt<string | undefined>>;
type Expected = string | undefined;
assert<Equals<Got, Expected>>();
}
{
type Got = UnpackEvt<Evt<string> | undefined>;
type Expected = string;
assert<Equals<Got, Expected>>();
}
{
type Got = UnpackEvt<EvtLike<string>>;
type Expected = string;
assert<Equals<Got, Expected>>();
}
{
type Got = UnpackEvt<{
evtText: Evt<string>;
evtCount: StatefulEvt<number>;
type: "FOO"
}>;
type Expected = {
evtText: string;
evtCount: number;
type: "FOO"
};
assert<Equals<Got, Expected>>();
}