-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.ts
119 lines (104 loc) · 2.76 KB
/
test.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/// <reference path="globals.d.ts" />
class Test {
test: object;
}
const go_package = "api_test";
type AliasInt = int;
type AliasBoolLiteral = false;
type AliasNumLiteral = 5;
type AliasStrLiteral = "Hello";
type AliasReference = Scalars;
type AliasUnionIntIn8 = int | int8;
type AliasUnionIntInt = int | int;
type AliasUnionInt16Number = int16 | number;
type AliasUnionStringByte = string | byte;
type AliasUnionStringString = string | string;
type AliasUnionStringStringNumber = string | string | number;
type AliasUnionStrLiteralNumLiteral = "Hello" | 42;
type AliasUnionStrLiteralStrLiteral = "Hello" | "World";
type AliasUnionReferenceString = UnionType1 | string;
type AliasUnionReferenceReference = UnionType1 | UnionType1;
type AliasUnionReferenceDiffReference = UnionType1 | UnionType2;
type AliasUnionArrayTypes = int[] | number[];
interface UnionType1 {
type: "hello";
dude: string;
test: string;
test2?: string;
test3: Ptr<string>;
test4: Scalars;
}
interface UnionType2 {
type: "world";
other_dude: string;
test: number;
test2: string;
test3: string;
test4: string;
}
class Scalars {
// Defaults
my_boolean: boolean;
my_number: number;
my_string: string;
// Golang type aliases
my_bool: bool;
my_int: int;
my_int8: int8;
my_int16: int16;
my_int32: int32;
my_int64: int64;
my_uint: uint;
my_uint8: uint8;
my_uint16: uint16;
my_uint32: uint32;
my_uint64: uint64;
my_float32: float32;
my_float64: float64;
my_byte: byte;
my_rune: rune;
// Literals
my_true_literal: true;
my_false_literal: false;
my_string_literal: "LITERAL";
my_numeric_literal: 1000;
}
class Complex {
my_complex: Scalars;
}
class Arrays {
// Defaults
my_boolean: boolean[];
my_number: number[];
my_string: string[];
// Golang type aliases
my_bool: bool[];
my_int: int[];
my_int8: int8[];
my_int16: int16[];
my_int32: int32[];
my_int64: int64[];
my_uint: uint[];
my_uint8: uint8[];
my_uint16: uint16[];
my_uint32: uint32[];
my_uint64: uint64[];
my_float32: float32[];
my_float64: float64[];
my_byte: byte[];
my_rune: rune[];
// Literals
my_true_literal: true[];
my_false_literal: false[];
my_string_literal: "LITERAL"[];
my_numeric_literal: 1000[];
// Complex
my_complex: Scalars[];
}
class Unions {
union_inline: boolean | boolean; // TODO: Maybe support inline primitives?
union_alias: AliasUnionReferenceDiffReference;
}
// TODO: Following imports into child files
// TODO: Other potentially scalar interpreted values like time.Time or time.Duration (probably just numerics)
// TODO: property signatures of embedded Map, Generic<T> and Object Literals