-
Notifications
You must be signed in to change notification settings - Fork 57
/
everything.atd
62 lines (51 loc) · 1.36 KB
/
everything.atd
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
(*
ATD type definitions for testing their translation to TypeScript.
*)
(* Testing raw JSON. Should map to type 'any'. *)
type anything = abstract
type different_kinds_of_things = [
| Root (* class name conflict *)
| Thing of int
| WOW <json name="wow">
| Amaze <json name="!!!"> of string list
]
(* TS keyword *)
type this = int
type ('a, 'b) parametrized_record = {
field_a: 'a;
~field_b: 'b list;
}
type 'a parametrized_tuple = ('a * 'a * int)
type simple_record = {
str: string;
}
type root = {
id <json name="ID">: string;
this: this;
items: int list list;
?maybe: int option;
?maybe2: simple_record option;
~extras: int list;
~answer <ts default="42">: int;
aliased: alias;
point: (float * float);
kinds: different_kinds_of_things list;
assoc1: (float * int) list;
assoc2: (string * int) list <json repr="object">;
assoc3: (float * int) list <ts repr="map">;
assoc4: (string * int) list <json repr="object"> <ts repr="map">;
~options: int option list;
~nullables: int nullable list;
untyped_things: abstract list;
foo: foo nullable;
parametrized_record: (int, float) parametrized_record;
parametrized_tuple: different_kinds_of_things parametrized_tuple;
anything: anything;
wrapped: string wrap list;
}
type alias = int list
type pair = (string * int)
type foo = {
foo: string;
}
type special_string = string wrap