forked from Wulf/tsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typescript.d.ts
66 lines (60 loc) · 1.33 KB
/
typescript.d.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
61
62
63
64
65
66
/* This file is generated and managed by tsync */
/**
* Variants should to discriminated unions
* The last serde/attribute combo matching the tag should be taken
*/
type Message =
| Message__UnitCaseLeft
| Message__RequestLongTake
| Message__Response;
/** Per Enum case Docs One */
type Message__UnitCaseLeft = {
last_precedent: "UnitCaseLeft";
};
/** Per Enum case Docs Two */
type Message__RequestLongTake = {
last_precedent: "RequestLongTake";
id: string;
method: string;
params: number;
};
type Message__Response = {
last_precedent: "Response";
id: string;
result: Date;
};
/** The default enum conversion uses external tagging */
type ExternalMessage =
/** Per Enum case Docs One */
| {
"UnitCaseLeft": {}
}
/** Per Enum case Docs Two */
| {
"RequestLongTake": {
id: string;
method: string;
params: number;
}
}
| {
"Response": {
id: string;
result: Date;
}
};
/**
* All Unit Enums go to union of constant strings
* even if have explicit numeric annotations
* There is no case renaming on default
*/
type Animal =
| "Dog" | "Cat";
type AnimalTwo =
| "dog_long_extra" | "cat";
/** Integer enums should follow rust discrimination if literals (doesn't evaluate expression) */
declare enum Foo {
Bar = 0,
Baz = 123,
Quux = 124,
}