|
238 | 238 | } |
239 | 239 |
|
240 | 240 | TS("typescript_extend_type", |
241 | | - "[keyword class] [def Foo] [keyword extends] [variable-3 Some][operator <][variable-3 Type][operator >] {}") |
| 241 | + "[keyword class] [def Foo] [keyword extends] [type Some][operator <][type Type][operator >] {}") |
242 | 242 |
|
243 | 243 | TS("typescript_arrow_type", |
244 | | - "[keyword let] [def x]: ([variable arg]: [variable-3 Type]) [operator =>] [variable-3 ReturnType]") |
| 244 | + "[keyword let] [def x]: ([variable arg]: [type Type]) [operator =>] [type ReturnType]") |
245 | 245 |
|
246 | 246 | TS("typescript_class", |
247 | 247 | "[keyword class] [def Foo] {", |
248 | 248 | " [keyword public] [keyword static] [property main]() {}", |
249 | | - " [keyword private] [property _foo]: [variable-3 string];", |
| 249 | + " [keyword private] [property _foo]: [type string];", |
250 | 250 | "}") |
251 | 251 |
|
252 | 252 | TS("typescript_literal_types", |
|
255 | 255 | " [property truthy]: [string 'true'] [operator |] [number 1] [operator |] [atom true];", |
256 | 256 | " [property falsy]: [string 'false'] [operator |] [number 0] [operator |] [atom false];", |
257 | 257 | "}", |
258 | | - "[keyword interface] [def MyInstance] [keyword extends] [variable-3 Sequelize].[variable-3 Instance] [operator <] [variable-3 MyAttributes] [operator >] {", |
259 | | - " [property rawAttributes]: [variable-3 MyAttributes];", |
| 258 | + "[keyword interface] [def MyInstance] [keyword extends] [type Sequelize].[type Instance] [operator <] [type MyAttributes] [operator >] {", |
| 259 | + " [property rawAttributes]: [type MyAttributes];", |
260 | 260 | " [property truthy]: [string 'true'] [operator |] [number 1] [operator |] [atom true];", |
261 | 261 | " [property falsy]: [string 'false'] [operator |] [number 0] [operator |] [atom false];", |
262 | 262 | "}") |
263 | 263 |
|
264 | 264 | TS("typescript_extend_operators", |
265 | 265 | "[keyword export] [keyword interface] [def UserModel] [keyword extends]", |
266 | | - " [variable-3 Sequelize].[variable-3 Model] [operator <] [variable-3 UserInstance], [variable-3 UserAttributes] [operator >] {", |
| 266 | + " [type Sequelize].[type Model] [operator <] [type UserInstance], [type UserAttributes] [operator >] {", |
267 | 267 | " [property findById]: (", |
268 | | - " [variable userId]: [variable-3 number]", |
269 | | - " ) [operator =>] [variable-3 Promise] [operator <] [variable-3 Array] [operator <] { [property id], [property name] } [operator >>];", |
| 268 | + " [variable userId]: [type number]", |
| 269 | + " ) [operator =>] [type Promise] [operator <] [type Array] [operator <] { [property id], [property name] } [operator >>];", |
270 | 270 | " [property updateById]: (", |
271 | | - " [variable userId]: [variable-3 number],", |
272 | | - " [variable isActive]: [variable-3 boolean]", |
273 | | - " ) [operator =>] [variable-3 Promise] [operator <] [variable-3 AccountHolderNotificationPreferenceInstance] [operator >];", |
| 271 | + " [variable userId]: [type number],", |
| 272 | + " [variable isActive]: [type boolean]", |
| 273 | + " ) [operator =>] [type Promise] [operator <] [type AccountHolderNotificationPreferenceInstance] [operator >];", |
274 | 274 | " }") |
275 | 275 |
|
276 | 276 | TS("typescript_interface_with_const", |
277 | 277 | "[keyword const] [def hello]: {", |
278 | | - " [property prop1][operator ?]: [variable-3 string];", |
279 | | - " [property prop2][operator ?]: [variable-3 string];", |
| 278 | + " [property prop1][operator ?]: [type string];", |
| 279 | + " [property prop2][operator ?]: [type string];", |
280 | 280 | "} [operator =] {};") |
281 | 281 |
|
282 | 282 | TS("typescript_double_extend", |
283 | 283 | "[keyword export] [keyword interface] [def UserAttributes] {", |
284 | | - " [property id][operator ?]: [variable-3 number];", |
285 | | - " [property createdAt][operator ?]: [variable-3 Date];", |
| 284 | + " [property id][operator ?]: [type number];", |
| 285 | + " [property createdAt][operator ?]: [type Date];", |
286 | 286 | "}", |
287 | | - "[keyword export] [keyword interface] [def UserInstance] [keyword extends] [variable-3 Sequelize].[variable-3 Instance][operator <][variable-3 UserAttributes][operator >], [variable-3 UserAttributes] {", |
288 | | - " [property id]: [variable-3 number];", |
289 | | - " [property createdAt]: [variable-3 Date];", |
| 287 | + "[keyword export] [keyword interface] [def UserInstance] [keyword extends] [type Sequelize].[type Instance][operator <][type UserAttributes][operator >], [type UserAttributes] {", |
| 288 | + " [property id]: [type number];", |
| 289 | + " [property createdAt]: [type Date];", |
290 | 290 | "}"); |
291 | 291 |
|
292 | 292 | TS("typescript_index_signature", |
293 | 293 | "[keyword interface] [def A] {", |
294 | | - " [[ [variable prop]: [variable-3 string] ]]: [variable-3 any];", |
295 | | - " [property prop1]: [variable-3 any];", |
| 294 | + " [[ [variable prop]: [type string] ]]: [type any];", |
| 295 | + " [property prop1]: [type any];", |
296 | 296 | "}"); |
297 | 297 |
|
298 | 298 | TS("typescript_generic_class", |
299 | | - "[keyword class] [def Foo][operator <][variable-3 T][operator >] {", |
| 299 | + "[keyword class] [def Foo][operator <][type T][operator >] {", |
300 | 300 | " [property bar]() {}", |
301 | | - " [property foo](): [variable-3 Foo] {}", |
| 301 | + " [property foo](): [type Foo] {}", |
302 | 302 | "}") |
303 | 303 |
|
304 | 304 | TS("typescript_type_when_keyword", |
305 | | - "[keyword export] [keyword type] [variable-3 AB] [operator =] [variable-3 A] [operator |] [variable-3 B];", |
306 | | - "[keyword type] [variable-3 Flags] [operator =] {", |
307 | | - " [property p1]: [variable-3 string];", |
308 | | - " [property p2]: [variable-3 boolean];", |
| 305 | + "[keyword export] [keyword type] [type AB] [operator =] [type A] [operator |] [type B];", |
| 306 | + "[keyword type] [type Flags] [operator =] {", |
| 307 | + " [property p1]: [type string];", |
| 308 | + " [property p2]: [type boolean];", |
309 | 309 | "};") |
310 | 310 |
|
311 | 311 | TS("typescript_type_when_not_keyword", |
312 | 312 | "[keyword class] [def HasType] {", |
313 | | - " [property type]: [variable-3 string];", |
314 | | - " [property constructor]([def type]: [variable-3 string]) {", |
| 313 | + " [property type]: [type string];", |
| 314 | + " [property constructor]([def type]: [type string]) {", |
315 | 315 | " [keyword this].[property type] [operator =] [variable-2 type];", |
316 | 316 | " }", |
317 | | - " [property setType]({ [def type] }: { [property type]: [variable-3 string]; }) {", |
| 317 | + " [property setType]({ [def type] }: { [property type]: [type string]; }) {", |
318 | 318 | " [keyword this].[property type] [operator =] [variable-2 type];", |
319 | 319 | " }", |
320 | 320 | "}") |
321 | 321 |
|
322 | 322 | TS("typescript_function_generics", |
323 | 323 | "[keyword function] [def a]() {}", |
324 | | - "[keyword function] [def b][operator <][variable-3 IA] [keyword extends] [variable-3 object], [variable-3 IB] [keyword extends] [variable-3 object][operator >]() {}", |
| 324 | + "[keyword function] [def b][operator <][type IA] [keyword extends] [type object], [type IB] [keyword extends] [type object][operator >]() {}", |
325 | 325 | "[keyword function] [def c]() {}") |
326 | 326 |
|
327 | 327 | TS("typescript_complex_return_type", |
328 | 328 | "[keyword function] [def A]() {", |
329 | 329 | " [keyword return] [keyword this].[property property];", |
330 | 330 | "}", |
331 | | - "[keyword function] [def B](): [variable-3 Promise][operator <]{ [[ [variable key]: [variable-3 string] ]]: [variable-3 any] } [operator |] [atom null][operator >] {", |
| 331 | + "[keyword function] [def B](): [type Promise][operator <]{ [[ [variable key]: [type string] ]]: [type any] } [operator |] [atom null][operator >] {", |
332 | 332 | " [keyword return] [keyword this].[property property];", |
333 | 333 | "}") |
334 | 334 |
|
335 | 335 | TS("typescript_complex_type_casting", |
336 | | - "[keyword const] [def giftpay] [operator =] [variable config].[property get]([string 'giftpay']) [keyword as] { [[ [variable platformUuid]: [variable-3 string] ]]: { [property version]: [variable-3 number]; [property apiCode]: [variable-3 string]; } };") |
| 336 | + "[keyword const] [def giftpay] [operator =] [variable config].[property get]([string 'giftpay']) [keyword as] { [[ [variable platformUuid]: [type string] ]]: { [property version]: [type number]; [property apiCode]: [type string]; } };") |
337 | 337 |
|
338 | 338 | var jsonld_mode = CodeMirror.getMode( |
339 | 339 | {indentUnit: 2}, |
|
0 commit comments