-
Notifications
You must be signed in to change notification settings - Fork 0
/
typescript.json
273 lines (273 loc) · 5.41 KB
/
typescript.json
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
{
"Constructor": {
"prefix": "ctor",
"body": [
"/**",
" *",
" */",
"constructor() {",
"\tsuper();",
"\t$0",
"}"
],
"description": "Constructor"
},
"Class Definition": {
"prefix": "class",
"body": [
"class ${1:name} {",
"\tconstructor(${2:parameters}) {",
"\t\t$0",
"\t}",
"}"
],
"description": "Class Definition"
},
"Public Method Definition": {
"prefix": "public method",
"body": [
"/**",
" * ${1:name}",
" */",
"public ${1:name}() {",
"\t$0",
"}"
],
"description": "Public Method Definition"
},
"Private Method Definition": {
"prefix": "private method",
"body": [
"private ${1:name}() {",
"\t$0",
"}"
],
"description": "Private Method Definition"
},
"Import external module.": {
"prefix": "import statement",
"body": [
"import { $0 } from \"${1:module}\";"
],
"description": "Import external module."
},
"Property getter": {
"prefix": "get",
"body": [
"",
"public get ${1:value}() : ${2:string} {",
"\t${3:return $0}",
"}",
""
],
"description": "Property getter"
},
"Log to the console": {
"prefix": "log",
"body": [
"console.log($1);",
"$0"
],
"description": "Log to the console"
},
"Log warning to console": {
"prefix": "warn",
"body": [
"console.warn($1);",
"$0"
],
"description": "Log warning to the console"
},
"Log error to console": {
"prefix": "error",
"body": [
"console.error($1);",
"$0"
],
"description": "Log error to the console"
},
"Define a full property": {
"prefix": "prop",
"body": [
"",
"private _${1:value} : ${2:string};",
"public get ${1:value}() : ${2:string} {",
"\treturn this._${1:value};",
"}",
"public set ${1:value}(v : ${2:string}) {",
"\tthis._${1:value} = v;",
"}",
""
],
"description": "Define a full property"
},
"Triple-slash reference": {
"prefix": "ref",
"body": [
"/// <reference path=\"$1\" />",
"$0"
],
"description": "Triple-slash reference"
},
"Property setter": {
"prefix": "set",
"body": [
"",
"public set ${1:value}(v : ${2:string}) {",
"\tthis.$3 = v;",
"}",
""
],
"description": "Property setter"
},
"Throw Exception": {
"prefix": "throw",
"body": [
"throw \"$1\";",
"$0"
],
"description": "Throw Exception"
},
"For Loop": {
"prefix": "for",
"body": [
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
"\tconst ${3:element} = ${2:array}[${1:index}];",
"\t$0",
"}"
],
"description": "For Loop"
},
"For-Each Loop using =>": {
"prefix": "foreach =>",
"body": [
"${1:array}.forEach(${2:element} => {",
"\t$0",
"});"
],
"description": "For-Each Loop using =>"
},
"For-In Loop": {
"prefix": "forin",
"body": [
"for (const ${1:key} in ${2:object}) {",
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
"\t\t$0",
"\t}",
"}"
],
"description": "For-In Loop"
},
"For-Of Loop": {
"prefix": "forof",
"body": [
"for (const ${1:iterator} of ${2:object}) {",
"\t$0",
"}"
],
"description": "For-Of Loop"
},
"Function Statement": {
"prefix": "function",
"body": [
"function ${1:name}(${2:params}:${3:type}) {",
"\t$0",
"}"
],
"description": "Function Statement"
},
"If Statement": {
"prefix": "if",
"body": [
"if (${1:condition}) {",
"\t$0",
"}"
],
"description": "If Statement"
},
"If-Else Statement": {
"prefix": "ifelse",
"body": [
"if (${1:condition}) {",
"\t$0",
"} else {",
"\t",
"}"
],
"description": "If-Else Statement"
},
"New Statement": {
"prefix": "new",
"body": [
"const ${1:name} = new ${2:type}(${3:arguments});$0"
],
"description": "New Statement"
},
"Switch Statement": {
"prefix": "switch",
"body": [
"switch (${1:key}) {",
"\tcase ${2:value}:",
"\t\t$0",
"\t\tbreak;",
"",
"\tdefault:",
"\t\tbreak;",
"}"
],
"description": "Switch Statement"
},
"While Statement": {
"prefix": "while",
"body": [
"while (${1:condition}) {",
"\t$0",
"}"
],
"description": "While Statement"
},
"Do-While Statement": {
"prefix": "dowhile",
"body": [
"do {",
"\t$0",
"} while (${1:condition});"
],
"description": "Do-While Statement"
},
"Try-Catch Statement": {
"prefix": "trycatch",
"body": [
"try {",
"\t$0",
"} catch (${1:error}) {",
"\t",
"}"
],
"description": "Try-Catch Statement"
},
"Set Timeout Function": {
"prefix": "settimeout",
"body": [
"setTimeout(() => {",
"\t$0",
"}, ${1:timeout});"
],
"description": "Set Timeout Function"
},
"Region Start": {
"prefix": "#region",
"body": [
"//#region $0"
],
"description": "Folding Region Start"
},
"Region End": {
"prefix": "#endregion",
"body": [
"//#endregion"
],
"description": "Folding Region End"
}
}