-
Notifications
You must be signed in to change notification settings - Fork 10
/
typescript.ts
75 lines (66 loc) · 1.36 KB
/
typescript.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
67
68
69
70
71
72
73
74
75
/* This file is generated and managed by tsync */
/**
* Internally tagged enums have a key-value pair
* that discrimate which variant it belongs to
*/
export type InternalTopping =
| InternalTopping__Pepperoni
| InternalTopping__ExtraCheese;
/**
* Tasty!
* Not vegetarian
*/
type InternalTopping__Pepperoni = {
type: "PEPPERONI";
};
/** For cheese lovers */
type InternalTopping__ExtraCheese = {
type: "EXTRA CHEESE";
KIND: string;
};
/**
* Externally tagged enums ascribe the value to a key
* that is the same as the variant name
*/
export type ExternalTopping =
/**
* Tasty!
* Not vegetarian
*/
| {
"Pepperoni": {}
}
/** For cheese lovers */
| {
"ExtraCheese": {
kind: string;
}
}
/**
* Custom toppings
* May expire soon
* Note: this test case is specifically for specifying a single type in the tuple
*/
| { "Custom": CustomTopping };
export interface CustomTopping {
name: string;
expires_in: Date;
}
export interface CustomToppingCamel {
name: string;
expiresIn: Date;
}
/**
* All Unit Enums go to union of constant strings
* even if have explicit numeric annotations
* There is no case renaming on default
*/
export type Animal =
| "Dog" | "Cat";
export type AnimalTwo =
| "dog_long_extra" | "cat";
export type Tagged =
| Tagged__Test;
type Tagged__Test = {
type: "Test";
};