-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.nt
71 lines (57 loc) · 1.33 KB
/
example.nt
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
61
62
63
64
65
66
67
68
69
70
import "ts-toolbelt" (A, F, L)
import "." ( __ )
import "./const.js"
( __capture__
, __kind__
, any_
, bigint_
, boolean_
, function_
, number_
, object_
, rest_
, string_
, symbol_
)
True : 1
ExtractSubcapture t :
if not t <: M.Primitive | M.BuiltIn and t <: object
then t ! (Exclude (keyof t) (keyof [] | keyof {}))
PartialAssignment key value :
if not value <: never and key <: string
then { value : k <- key }
EmptyToNever t :
case t of
{} -> never
_ -> t
Kind
: typeof any_
| typeof rest_
| typeof string_
| typeof number_
| typeof boolean_
| typeof function_
| typeof symbol_
| typeof bigint_
| typeof object_
interface Hole (type_ = any) (label = any) where
readonly index __kind__ : Label
T : Type
HoleInnerType t :
case t of
Hole ?u -> u
_ -> t
interface Capture (name <: string = any) (pattern = any) where
readonly index __capture__ : name
readonly pattern : pattern
RecursiveExpandCapture t :
-- Guard against any as mapping it will cause an infite descent
if t == any
then t
else
case t of
Hole | Capture -> ExpandCapture T
Record string any -> { ExpandCapture T!K : k <- keyof T }
_ -> t
PatternHandler pattern : (arg : VariableCapture pattern) => unknown
GenericFunctionLiteral : forall t, u . (arg : t) => u