lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

syntax_test_typescript.ts (33065B)


      1 // SYNTAX TEST "Packages/JavaScript/TypeScript.sublime-syntax"
      2 
      3 /* Import/Export */
      4 
      5     import type T from 'somewhere';
      6 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import
      7 //  ^^^^^^ keyword.control.import-export
      8 //         ^^^^ keyword.control.import-export
      9 //              ^ variable.other.readwrite
     10 //                ^^^^ keyword.control.import-export
     11 //                     ^^^^^^^^^^^ meta.string string.quoted.single
     12 
     13     import type { U, V } from 'somewhere';
     14 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.import
     15 //  ^^^^^^ keyword.control.import-export
     16 //         ^^^^ keyword.control.import-export
     17 //              ^^^^^^^^ meta.block
     18 //                ^ variable.other.readwrite
     19 //                 ^ punctuation.separator.comma
     20 //                   ^ variable.other.readwrite
     21 //                       ^^^^ keyword.control.import-export
     22 //                            ^^^^^^^^^^^ meta.string string.quoted.single
     23 
     24     export type T = any;
     25 //  ^^^^^^^^^^^^^^^^^^^ meta.export
     26 //  ^^^^^^ keyword.control.import-export
     27 //         ^^^^^^^^^^^^ meta.type-alias
     28 //                     ^ punctuation.terminator.statement.empty - meta.export
     29 
     30     export interface Foo {}
     31 //  ^^^^^^^^^^^^^^^^^^^^^^^ meta.export
     32 //  ^^^^^^ keyword.control.import-export
     33 //         ^^^^^^^^^^^^^^^^ meta.interface
     34 //         ^^^^^^^^^ keyword.declaration
     35 //                   ^^^ entity.name.interface
     36 //                       ^^ meta.block
     37 
     38     export namespace Foo {}
     39 //  ^^^^^^^^^^^^^^^^^^^^^^^ meta.export
     40 //  ^^^^^^ keyword.control.import-export
     41 //         ^^^^^^^^^^^^^^^^ meta.namespace
     42 //         ^^^^^^^^^ keyword.declaration
     43 //                   ^^^ entity.name.namespace
     44 //                       ^^ meta.block
     45 
     46 /* Declarations */
     47 
     48     interface Foo {
     49 //  ^^^^^^^^^^^^^^^^ meta.interface
     50 //  ^^^^^^^^^ keyword.declaration
     51 //            ^^^ entity.name.interface
     52 //                ^ meta.block punctuation.section.block.begin
     53         foo: any;
     54 //^^^^^^^^^^^^^^^^ meta.interface meta.block
     55 //      ^^^ variable.other.readwrite
     56 //         ^ punctuation.separator.type
     57 //           ^^^ meta.type support.type.any
     58 //              ^ punctuation.separator
     59         bar?: any;
     60 //^^^^^^^^^^^^^^^^^ meta.interface meta.block
     61 //      ^^^ variable.other.readwrite
     62 //         ^ storage.modifier.optional
     63 //          ^ punctuation.separator.type
     64 //            ^^^ meta.type support.type.any
     65 //               ^ punctuation.separator
     66     }
     67 //  ^ meta.block punctuation.section.block.end
     68 
     69     interface Foo < T > extends Bar < T > {}
     70 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface
     71 //  ^^^^^^^^^ keyword.declaration
     72 //            ^^^ entity.name.interface
     73 //                ^^^^^ meta.generic
     74 //                ^ punctuation.definition.generic.begin
     75 //                  ^ variable.parameter.generic
     76 //                    ^ punctuation.definition.generic.end
     77 //                      ^^^^^^^ storage.modifier.extends
     78 //                              ^^^ entity.other.inherited-class
     79 //                                  ^^^^^ meta.interface meta.generic
     80 //                                  ^ punctuation.definition.generic.begin
     81 //                                    ^ support.class
     82 //                                      ^ punctuation.definition.generic.end
     83 
     84     interface Foo extends Bar, Baz {}
     85 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interface
     86 //                ^^^^^^^ storage.modifier.extends
     87 //                        ^^^ entity.other.inherited-class
     88 //                           ^ punctuation.separator.comma
     89 //                             ^^^ entity.other.inherited-class
     90 
     91     enum Foo {
     92 //  ^^^^^^^^^^^ meta.enum
     93 //  ^^^^ storage.type
     94 //       ^^^ entity.name.enum
     95 //           ^ punctuation.section.block.begin
     96         x,
     97 //      ^ variable.other.readwrite
     98 //       ^ punctuation.separator.comma
     99         y = 2,
    100 //      ^ variable.other.readwrite
    101 //        ^ keyword.operator.assignment
    102 //          ^ meta.number.integer.decimal.js constant.numeric.value.js
    103 //           ^ punctuation.separator.comma
    104 
    105         'FOO'
    106 //      ^^^^^ meta.string string.quoted.single
    107         "FOO"
    108 //      ^^^^^ meta.string string.quoted.double
    109     }
    110 //  ^ meta.enum meta.block punctuation.section.block.end
    111 
    112     const enum Foo {}
    113 //  ^^^^^ keyword.declaration
    114 //        ^^^^^^^^^^^ meta.enum
    115 //        ^^^^ storage.type
    116 //             ^^^ entity.name.enum
    117 
    118     declare enum Foo {}
    119 //  ^^^^^^^ storage.type
    120 //          ^^^^^^^^^^^ meta.enum
    121 //          ^^^^ storage.type
    122 //               ^^^ entity.name.enum
    123 
    124     type x < T > = any;
    125 //  ^^^^^^^^^^^^^^^^^^ meta.type-alias
    126 //  ^^^^ storage.type
    127 //       ^ entity.name.type
    128 //         ^^^^^ meta.generic
    129 //         ^ punctuation.definition.generic.begin
    130 //           ^ variable.parameter.generic
    131 //             ^ punctuation.definition.generic.end
    132 //               ^ keyword.operator.assignment
    133 //                 ^^^ meta.type-alias support.type.any
    134 
    135     type x < T = Foo > = any;
    136 //  ^^^^^^^^^^^^^^^^^^^^^^^^ meta.type-alias
    137 //  ^^^^ storage.type
    138 //       ^ entity.name.type
    139 //         ^^^^^^^^^^^ meta.generic
    140 //         ^ punctuation.definition.generic.begin
    141 //           ^ variable.parameter.generic
    142 //             ^ keyword.operator.assignment
    143 //               ^^^ support.class
    144 //                   ^ punctuation.definition.generic.end
    145 //                     ^ keyword.operator.assignment
    146 //                       ^^^ meta.type-alias support.type.any
    147 
    148     class Foo {
    149         foo: any = 42;
    150 //      ^^^ variable.other.readwrite
    151 //         ^ punctuation.separator.type
    152 //           ^^^ meta.type support.type.any
    153 //               ^ keyword.operator.assignment
    154 
    155         foo?: any;
    156 //      ^^^ variable.other.readwrite
    157 //         ^ storage.modifier.optional
    158 //          ^ punctuation.separator.type
    159 //            ^^^ meta.type support.type.any
    160 
    161         declare foo;
    162 //      ^^^^^^^ storage.modifier
    163 //              ^^^ variable.other.readwrite
    164 
    165         #foo: any;
    166 //      ^ punctuation.definition.variable
    167 //       ^^^ variable.other.readwrite
    168 //          ^ punctuation.separator.type
    169 //            ^^^ meta.type support.type.any
    170 
    171         public foo;
    172 //      ^^^^^^ storage.modifier
    173 //             ^^^ variable.other.readwrite
    174         private foo;
    175 //      ^^^^^^^ storage.modifier
    176 //              ^^^ variable.other.readwrite
    177         protected foo;
    178 //      ^^^^^^^^^ storage.modifier
    179 //                ^^^ variable.other.readwrite
    180         readonly foo;
    181 //      ^^^^^^^^ storage.modifier
    182 //               ^^^ variable.other.readwrite
    183 
    184         readonly;
    185 //      ^^^^^^^^ variable.other.readwrite
    186 
    187         readonly() {}
    188 //      ^^^^^^^^^^ meta.function
    189 //      ^^^^^^^^ entity.name.function
    190 
    191         private static readonly abstract declare public;
    192 //      ^^^^^^^ storage.modifier
    193 //              ^^^^^^ storage.modifier
    194 //                     ^^^^^^^^ storage.modifier
    195 //                              ^^^^^^^^ storage.modifier
    196 //                                       ^^^^^^^ storage.modifier
    197 //                                               ^^^^^^ variable.other.readwrite
    198 
    199         foo(): any {}
    200 //      ^^^^^^^^^^^^^ meta.function
    201 //      ^^^ entity.name.function
    202 //           ^ punctuation.separator.type
    203 //             ^^^ meta.type support.type.any
    204 //                 ^^ meta.function meta.block
    205 
    206         foo<T>(): any {}
    207 //      ^^^^^^^^^^^^^^^^ meta.function
    208 //      ^^^ entity.name.function
    209 //         ^^^ meta.generic
    210 //              ^ punctuation.separator.type
    211 //                ^^^ meta.type support.type.any
    212 //                    ^^ meta.function meta.block
    213 
    214         @decorator<T>()
    215 //      ^^^^^^^^^^^^^^^ meta.annotation
    216 //      ^ punctuation.definition.annotation
    217 //       ^^^^^^^^^ variable.annotation
    218 //                ^^^ meta.generic
    219 //                ^ punctuation.definition.generic.begin
    220 //                 ^ support.class
    221 //                  ^ punctuation.definition.generic.end
    222 //                   ^^ meta.group
    223 //                   ^ punctuation.section.group.begin
    224 //                    ^ punctuation.section.group.end
    225 
    226         foo() {}
    227 //      ^^^^^^^^ meta.function
    228 //      ^^^ entity.name.function
    229 //         ^^ meta.function.parameters
    230 //         ^ punctuation.section.group.begin
    231 //          ^ punctuation.section.group.end
    232 //            ^^ meta.block
    233 //            ^ punctuation.section.block.begin
    234 //             ^ punctuation.section.block.end
    235     }
    236 
    237     abstract class Foo {
    238 //  ^^^^^^^^ storage.modifier
    239 //           ^^^^^ meta.class keyword.declaration.class
    240 
    241         abstract foo;
    242 //      ^^^^^^^^ storage.modifier
    243 //               ^^^ variable.other.readwrite
    244 
    245         abstract foo();
    246 //      ^^^^^^^^ storage.modifier
    247 //               ^^^ entity.name.function
    248 
    249         abstract *foo();
    250 //      ^^^^^^^^ storage.modifier
    251 //               ^ keyword.generator.asterisk
    252 //                ^^^ entity.name.function
    253 
    254         abstract async foo();
    255 //      ^^^^^^^^ storage.modifier
    256 //               ^^^^^ keyword.declaration.async
    257 //                     ^^^ entity.name.function
    258 
    259         abstract async() {}
    260 //      ^^^^^^^^ storage.modifier
    261 //               ^^^^^ entity.name.function
    262 
    263         abstract get foo() {}
    264 //      ^^^^^^^^ storage.modifier
    265 //               ^^^ storage.type.accessor
    266 //                   ^^^ entity.name.function
    267 
    268         abstract get() {}
    269 //      ^^^^^^^^ storage.modifier
    270 //               ^^^ entity.name.function
    271 
    272     }
    273 
    274     class Foo < T > extends Bar implements Baz, Xyzzy { }
    275 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class
    276 //  ^^^^^ keyword.declaration.class
    277 //        ^^^ entity.name.class
    278 //            ^^^^^ meta.generic
    279 //            ^ punctuation.definition.generic.begin
    280 //              ^ variable.parameter.generic
    281 //                ^ punctuation.definition.generic.end
    282 //                  ^^^^^^^ storage.modifier.extends
    283 //                          ^^^ entity.other.inherited-class
    284 //                              ^^^^^^^^^^ storage.modifier.implements
    285 //                                         ^^^ entity.other.inherited-class
    286 //                                            ^ punctuation.separator.comma
    287 //                                              ^^^^^ entity.other.inherited-class
    288 //                                                    ^^^ meta.block
    289 
    290     class Foo extends Bar < T > implements Bar < T > {}
    291 //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class
    292 //                    ^^^ entity.other.inherited-class
    293 //                        ^^^^^ meta.generic
    294 //                        ^ punctuation.definition.generic.begin
    295 //                          ^ support.class
    296 //                            ^ punctuation.definition.generic.end
    297 //                                         ^^^ entity.other.inherited-class
    298 //                                             ^^^^^ meta.generic
    299 //                                             ^ punctuation.definition.generic.begin
    300 //                                               ^ support.class
    301 //                                                 ^ punctuation.definition.generic.end
    302 //                                                   ^^ meta.block
    303 
    304     namespace Foo {
    305 //  ^^^^^^^^^^^^^^^^ meta.namespace
    306 //  ^^^^^^^^^ keyword.declaration
    307 //            ^^^ entity.name.namespace
    308 //                ^ meta.block punctuation.section.block.begin
    309     }
    310 //  ^ meta.block punctuation.section.block.end
    311 
    312 /* Annotations */
    313 
    314 var x: any = 42;
    315 //   ^ punctuation.separator.type
    316 //     ^^^ meta.type support.type.any
    317 //         ^^^^^^ - meta.type
    318 //         ^ keyword.operator.assignment
    319 
    320 let x: any = 42;
    321 //   ^ punctuation.separator.type
    322 //     ^^^ meta.type support.type.any
    323 //         ^^^^^^ - meta.type
    324 //         ^ keyword.operator.assignment
    325 
    326 const x: any = 42;
    327 //     ^ punctuation.separator.type
    328 //       ^^^ meta.type support.type.any
    329 //           ^^^^^^ - meta.type
    330 //           ^ keyword.operator.assignment
    331 
    332 let [ x: any = 42 ];
    333 //     ^ punctuation.separator.type
    334 //       ^^^ meta.type support.type.any
    335 //           ^ keyword.operator.assignment
    336 
    337 let x !: any ;
    338 //  ^ variable.other.readwrite
    339 //    ^ storage.modifier.definite
    340 //     ^ punctuation.separator.type
    341 //       ^^^ meta.type support.type.any
    342 
    343 function f(x: any = 42) {}
    344 //          ^ punctuation.separator.type
    345 //            ^^^meta.type support.type.any
    346 //                ^ keyword.operator.assignment
    347 
    348 function f(public x) {}
    349 //         ^^^^^^ storage.modifier
    350 //                ^ meta.binding.name variable.parameter.function
    351 
    352 function f(readonly x) {}
    353 //         ^^^^^^^^ storage.modifier
    354 //                  ^ meta.binding.name variable.parameter.function
    355 
    356 function f(readonly ...x) {}
    357 //         ^^^^^^^^ storage.modifier
    358 //                  ^^^keyword.operator.spread
    359 //                     ^ meta.binding.name variable.parameter.function
    360 
    361 function f(readonly) {}
    362 //         ^^^^^^^^ meta.binding.name variable.parameter.function
    363 
    364 function f(x?: any) {}
    365 //          ^ storage.modifier.optional
    366 //           ^ punctuation.separator.type
    367 
    368 function f(): any {}
    369 //^^^^^^^^^^^^^^^^^^ meta.function
    370 //          ^ punctuation.separator.type
    371 //            ^^^meta.type support.type.any
    372 //                ^^ meta.block
    373 
    374 function f ( x : any , ... y : any ) {}
    375 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    376 //           ^ meta.binding.name variable.parameter.function
    377 //             ^ punctuation.separator.type
    378 //               ^^^ meta.type support.type.any
    379 //                   ^ punctuation.separator.parameter.function
    380 //                     ^^^ keyword.operator.spread
    381 //                         ^ meta.binding.name variable.parameter.function
    382 //                           ^ punctuation.separator.type
    383 //                             ^^^ meta.type support.type.any
    384 
    385 function f ( @foo x , @bar() y ) {}
    386 //           ^^^^ meta.annotation
    387 //           ^ punctuation.definition.annotation
    388 //            ^^^ variable.annotation
    389 //                ^ meta.binding.name variable.parameter.function
    390 //                    ^^^^^^ meta.annotation
    391 //                    ^ punctuation.definition.annotation
    392 //                     ^^^^^ meta.function-call
    393 //                     ^^^ variable.function
    394 //                           ^ meta.binding.name variable.parameter.function
    395 
    396 function f<T, U>() {}
    397 //^^^^^^^^^^^^^^^^^^^ meta.function
    398 //        ^^^^^^ meta.generic
    399 //         ^ variable.parameter.generic
    400 //          ^ punctuation.separator.comma
    401 //            ^ variable.parameter.generic
    402 
    403 function f(x): x is any {};
    404 //^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    405 //           ^ punctuation.separator.type
    406 //             ^^^^^^^^^ meta.type
    407 //               ^^ keyword.operator.word
    408 //                  ^^^ support.type.any
    409 
    410 function f(x): asserts x is any {};
    411 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
    412 //           ^ punctuation.separator.type
    413 //            ^^^^^^^^^^^^^^^^^ meta.type
    414 //             ^^^^^^^ storage.modifier.asserts
    415 //                       ^^ keyword.operator.word
    416 //                          ^^^ support.type.any
    417 
    418 function f(this : any) {}
    419 //         ^^^^ variable.language.this
    420 //              ^ punctuation.separator.type
    421 //                ^^^ support.type.any
    422 
    423     (x: any) => 42;
    424 //  ^^^^^^^^^^^^^^ meta.function
    425 //    ^ punctuation.separator.type
    426 //      ^^^ meta.type support.type.any
    427 //           ^^ keyword.declaration.function.arrow
    428 
    429     x ? (y) : z;
    430 //  ^ variable.other.readwrite
    431 //    ^ keyword.operator.ternary
    432 //      ^^^ meta.group
    433 //       ^ variable.other.readwrite
    434 //          ^ keyword.operator.ternary
    435 
    436     x ? (y) : T => r : z;
    437 //  ^ variable.other.readwrite
    438 //    ^ keyword.operator.ternary
    439 //      ^^^^^^^^^^^^^ meta.function
    440 //       ^ meta.binding.name variable.parameter.function
    441 //          ^ punctuation.separator.type
    442 //            ^ meta.type support.class
    443 //              ^^ keyword.declaration.function.arrow
    444 //                 ^meta.block variable.other.readwrite
    445 //                   ^ keyword.operator.ternary
    446 //                     ^ variable.other.readwrite
    447 
    448     x ? y : T => z;
    449 //      ^ variable.other.readwrite - variable.parameter
    450 //        ^ keyword.operator.ternary
    451 //          ^^^^^^ meta.function
    452 //          ^ variable.parameter.function
    453 //            ^^ keyword.declaration.function.arrow
    454 
    455     async (x): T => y;
    456 //  ^^^^^^^^^^^^^^^^^ meta.function
    457 //  ^^^^^ keyword.declaration.async
    458 //         ^ meta.binding.name variable.parameter.function
    459 //           ^ punctuation.separator.type
    460 //             ^ meta.type support.class
    461 //               ^^ keyword.declaration.function.arrow
    462 //                  ^ meta.block variable.other.readwrite
    463 
    464     x ? async (y) : T => r : z;
    465 //      ^^^^^^^^^^^^^^^^^^ meta.function
    466 //                ^ punctuation.separator.type
    467 //                         ^ keyword.operator.ternary
    468 
    469     x ? async (y) : T;
    470 //      ^^^^^ variable.function
    471 //                ^ keyword.operator.ternary
    472 
    473 /* Assertions */
    474 
    475 x as boolean;
    476 //^^ keyword.operator.type
    477 //   ^^^^^^^ meta.type support.type.primitive.boolean
    478 
    479 x as const;
    480 //^^ keyword.operator.type
    481 //   ^^^^^ storage.modifier.const
    482 
    483     foo!.bar;
    484 //     ^^ punctuation.accessor
    485 
    486     x ! ;
    487 //  ^ variable.other.readwrite
    488 //    ^ keyword.operator.type
    489 //      ^ punctuation.terminator.statement
    490 
    491 /* Types */
    492 
    493 let x: any;
    494 //     ^^^ support.type.any
    495 let x: void;
    496 //     ^^^^ support.type.void
    497 let x: never;
    498 //     ^^^^^ support.type.never
    499 let x: unknown;
    500 //     ^^^^^^^ support.type.unknown
    501 
    502 let x: boolean;
    503 //     ^^^^^^^ support.type.primitive.boolean
    504 let x: number;
    505 //     ^^^^^^ support.type.primitive.number
    506 let x: string;
    507 //     ^^^^^^ support.type.primitive.string
    508 let x: null;
    509 //     ^^^^ support.type.primitive.null
    510 let x: undefined;
    511 //     ^^^^^^^^^ support.type.primitive.undefined
    512 let x: object;
    513 //     ^^^^^^ support.type.primitive.object
    514 let x: symbol;
    515 //     ^^^^^^ support.type.primitive.symbol
    516 let x: unique symbol;
    517 //     ^^^^^^ storage.modifier.unique
    518 //            ^^^^^^ support.type.primitive.symbol
    519 let x: bigint;
    520 //     ^^^^^^ support.type.primitive.bigint
    521 
    522 let x: Foo;
    523 //     ^^^ support.class
    524 
    525 let x: any [ ];
    526 //     ^^^^^^ meta.type
    527 //     ^^^ support.type.any
    528 //         ^ storage.modifier.array
    529 //           ^ storage.modifier.array
    530 
    531 let x: readonly any [];
    532 //     ^^^^^^^^^^^^^^^ meta.type
    533 //     ^^^^^^^^ storage.modifier.readonly
    534 //              ^^^ support.type.any
    535 //                  ^^ storage.modifier.array
    536 
    537 let x: any [ "foo" | 'bar' ];
    538 //     ^^^^^^^^^^^^^^^^^^^^^ meta.type
    539 //     ^^^ support.type.any
    540 //         ^^^^^^^^^^^^^^^^^ meta.brackets
    541 //         ^ punctuation.section.brackets.begin
    542 //           ^^^^^ meta.string string.quoted.double
    543 //                 ^ keyword.operator.type.union
    544 //                   ^^^^^ meta.string string.quoted.single
    545 //                         ^ punctuation.section.brackets.end
    546 
    547 
    548 let x: any [ 0 ];
    549 //         ^^^^^ meta.type meta.brackets
    550 //         ^ punctuation.section.brackets.begin
    551 //           ^ meta.number.integer.decimal.js constant.numeric.value.js
    552 //             ^ punctuation.section.brackets.end
    553 
    554 let x: any [
    555 //     ^^^^^^ meta.type
    556 //     ^^^ support.type.any
    557 //         ^ punctuation.section.brackets.begin
    558     ];
    559 //  ^ punctuation.section.brackets.end
    560 
    561 
    562 let x: any
    563 //     ^^^ meta.type support.type.any
    564     [];
    565 //  ^^ meta.sequence punctuation.section.brackets - meta.type
    566 
    567 let x: Foo<any, any>;
    568 //     ^^^^^^^^^^^^^ meta.type
    569 //     ^^^ support.class
    570 //        ^^^^^^^^^^ meta.generic
    571 //        ^ punctuation.definition.generic.begin
    572 //         ^^^ support.type.any
    573 //            ^ punctuation.separator.comma
    574 //              ^^^ support.type.any
    575 //                 ^ punctuation.definition.generic.end
    576 
    577 
    578 function f<T extends Foo>() {}
    579 //        ^^^^^^^^^^^^^^^ meta.function meta.generic
    580 //         ^ variable.parameter.generic
    581 //           ^^^^^^^ storage.modifier.extends
    582 //                   ^^^ support.class
    583 
    584 let x: [ any , any ? , ... any [] ];
    585 //     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.type meta.sequence
    586 //     ^ punctuation.section.brackets.begin
    587 //       ^^^ support.type.any
    588 //           ^ punctuation.separator.comma
    589 //             ^^^ support.type.any
    590 //                 ^ storage.modifier.optional
    591 //                   ^ punctuation.separator.comma
    592 //                     ^^^ keyword.operator.spread
    593 //                         ^^^ support.type.any
    594 //                             ^^ storage.modifier.array
    595 //                                ^ punctuation.section.brackets.end
    596 
    597 let x: any & any;
    598 //     ^^^^^^^^^ meta.type
    599 //     ^^^ support.type.any
    600 //         ^ keyword.operator.type.intersection
    601 //           ^^^ support.type.any
    602 
    603 let x: any | any;
    604 //     ^^^^^^^^^ meta.type
    605 //     ^^^ support.type.any
    606 //         ^ keyword.operator.type.union
    607 //           ^^^ support.type.any
    608 
    609 let x: "a string";
    610 //     ^ meta.type meta.string string.quoted.double
    611 
    612 let x: 'a string';
    613 //     ^ meta.type meta.string string.quoted.single
    614 
    615 let x: `a string${any}`;
    616 //     ^^^^^^^^^^^^^^^^ meta.type meta.string
    617 //     ^^^^^^^^^ string.quoted.other
    618 //     ^ punctuation.definition.string.begin
    619 //              ^^^^^^ meta.interpolation - string
    620 //              ^^ punctuation.section.interpolation.begin
    621 //                ^^^ source.js.embedded support.type.any
    622 //                   ^ punctuation.section.interpolation.end
    623 //                    ^ string.quoted.other punctuation.definition.string.end
    624 
    625 let x: 42;
    626 //     ^^ meta.type meta.number.integer.decimal constant.numeric.value
    627 
    628 let x: -42;
    629 //     ^^^ meta.type
    630 //     ^ keyword.operator.arithmetic
    631 //      ^^ meta.number.integer.decimal constant.numeric.value
    632 
    633 let x: 1.5;
    634 //     ^^^ meta.type meta.number.float.decimal constant.numeric.value
    635 
    636 let x: 1e10;
    637 //     ^^^^ meta.type meta.number.float.decimal constant.numeric.value
    638 
    639 let x: 0xabc;
    640 //     ^^^^^ meta.type meta.number.integer.hexadecimal
    641 
    642 let x: typeof Foo;
    643 //     ^^^^^^^^^^ meta.type
    644 //     ^^^^^ keyword.operator.type
    645 //            ^^^ support.class
    646 let x: keyof Foo;
    647 //     ^^^^^^^^^ meta.type
    648 //     ^^^^^ keyword.operator.type
    649 //           ^^^ support.class
    650 
    651 let x: Foo.bar;
    652 //     ^^^^^^^ meta.type
    653 //     ^^^ support.class
    654 //        ^ punctuation.accessor
    655 //         ^^^ support.class
    656 
    657 let x: {
    658 //     ^ meta.type punctuation.section.block.begin
    659 
    660     a : any ,
    661 //  ^ variable.other.readwrite
    662 //    ^ punctuation.separator.type
    663 //      ^^^ support.type.any
    664 //          ^ punctuation.separator
    665 
    666     b ? : any ;
    667 //  ^ variable.other.readwrite
    668 //    ^ storage.modifier.optional
    669 //      ^ punctuation.separator.type
    670 //        ^^^ support.type.any
    671 //            ^ punctuation.separator
    672 
    673     readonly c : any ;
    674 //  ^^^^^^^^ storage.modifier
    675 //           ^ variable.other.readwrite
    676 //             ^ punctuation.separator.type
    677 //               ^^^ support.type.any
    678 //                   ^ punctuation.separator
    679 
    680     ( foo : any ) : any ;
    681 //  ^ punctuation.section.group.begin
    682 //    ^^^ meta.binding.name variable.parameter.function
    683 //        ^ punctuation.separator.type
    684 //          ^^^ support.type.any
    685 //              ^ punctuation.section.group.end
    686 //                ^ punctuation.separator.type
    687 //                  ^^^ support.type.any
    688 //                      ^ punctuation.separator
    689 
    690 
    691     <T>( foo : any ) : any ;
    692 //  ^^^ meta.generic
    693 //  ^ punctuation.definition.generic.begin
    694 //   ^ meta.generic variable.parameter.generic
    695 //    ^ punctuation.definition.generic.end
    696 //     ^ punctuation.section.group.begin
    697 //       ^^^ meta.binding.name variable.parameter.function
    698 //           ^ punctuation.separator.type
    699 //             ^^^ support.type.any
    700 //                 ^ punctuation.section.group.end
    701 //                   ^ punctuation.separator.type
    702 //                     ^^^ support.type.any
    703 //                         ^ punctuation.separator
    704 
    705     a ( foo : any ) : any ;
    706 //  ^ variable.other.readwrite
    707 //    ^ punctuation.section.group.begin
    708 //      ^^^ meta.binding.name variable.parameter.function
    709 //          ^ punctuation.separator.type
    710 //            ^^^ support.type.any
    711 //                ^ punctuation.section.group.end
    712 //                  ^ punctuation.separator.type
    713 //                    ^^^ support.type.any
    714 //                        ^ punctuation.separator
    715 
    716 
    717     a <T>( foo : any ) : any ;
    718 //  ^ variable.other.readwrite
    719 //    ^^^ meta.generic
    720 //    ^ punctuation.definition.generic.begin
    721 //     ^ meta.generic variable.parameter.generic
    722 //      ^ punctuation.definition.generic.end
    723 //       ^ punctuation.section.group.begin
    724 //         ^^^ meta.binding.name variable.parameter.function
    725 //             ^ punctuation.separator.type
    726 //               ^^^ support.type.any
    727 //                   ^ punctuation.section.group.end
    728 //                     ^ punctuation.separator.type
    729 //                       ^^^ support.type.any
    730 //                           ^ punctuation.separator
    731 
    732     new ( foo : any ) : any ;
    733 //      ^ punctuation.section.group.begin
    734 //        ^^^ meta.binding.name variable.parameter.function
    735 //            ^ punctuation.separator.type
    736 //              ^^^ support.type.any
    737 //                  ^ punctuation.section.group.end
    738 //                    ^ punctuation.separator.type
    739 //                      ^^^ support.type.any
    740 //                          ^ punctuation.separator
    741 
    742     new <T>( foo : any ) : any ;
    743 //      ^^^ meta.generic
    744 //      ^ punctuation.definition.generic.begin
    745 //       ^ meta.generic variable.parameter.generic
    746 //        ^ punctuation.definition.generic.end
    747 //         ^ punctuation.section.group.begin
    748 //           ^^^ meta.binding.name variable.parameter.function
    749 //               ^ punctuation.separator.type
    750 //                 ^^^ support.type.any
    751 //                     ^ punctuation.section.group.end
    752 //                       ^ punctuation.separator.type
    753 //                         ^^^ support.type.any
    754 //                             ^ punctuation.separator
    755 
    756     [ foo : string ] : any ;
    757 //  ^^^^^^^^^^^^^^^^ meta.brackets
    758 //  ^ punctuation.section.brackets.begin
    759 //    ^^^ variable.other.readwrite
    760 //        ^ punctuation.separator.type
    761 //          ^^^^^^ support.type.primitive.string
    762 //                 ^ punctuation.section.brackets.end
    763 //                   ^ punctuation.separator.type
    764 //                     ^^^ support.type.any
    765 //                         ^ punctuation.separator
    766 
    767     [ foo : number ] : any ;
    768 //  ^^^^^^^^^^^^^^^^ meta.brackets
    769 //  ^ punctuation.section.brackets.begin
    770 //    ^^^ variable.other.readwrite
    771 //        ^ punctuation.separator.type
    772 //          ^^^^^^ support.type.primitive.number
    773 //                 ^ punctuation.section.brackets.end
    774 //                   ^ punctuation.separator.type
    775 //                     ^^^ support.type.any
    776 //                         ^ punctuation.separator
    777 
    778     [ P in keyof T ] : T [ P ] ;
    779 //  ^^^^^^^^^^^^^^^^ meta.brackets
    780 //  ^ punctuation.section.brackets.begin
    781 //    ^ variable.other.readwrite
    782 //      ^^ keyword.operator.type
    783 //         ^^^^^ keyword.operator.type
    784 //               ^ meta.brackets support.class
    785 //                 ^ punctuation.section.brackets.end
    786 //                   ^ punctuation.separator.type
    787 //                     ^ support.class
    788 //                       ^^^^^ meta.brackets
    789 //                       ^ punctuation.section.brackets.begin
    790 //                         ^ support.class
    791 //                           ^ punctuation.section.brackets.end
    792 //                             ^ punctuation.separator
    793 
    794     [ P in keyof T as U ] : any ;
    795 //  ^^^^^^^^^^^^^^^^^^^^^ meta.brackets
    796 //  ^ punctuation.section.brackets.begin
    797 //    ^ variable.other.readwrite
    798 //      ^^ keyword.operator.type
    799 //         ^^^^^ keyword.operator.type
    800 //               ^ meta.brackets support.class
    801 //                 ^^ keyword.operator.type
    802 //                    ^ meta.brackets support.class
    803 //                      ^ punctuation.section.brackets.end
    804 
    805     - readonly [ P in keyof T ] - ? : T [ P ] ;
    806 //  ^ storage.modifier
    807 //    ^^^^^^^^ storage.modifier
    808 //             ^^^^^^^^^^^^^^^^ meta.brackets
    809 //             ^ punctuation.section.brackets.begin
    810 //               ^ variable.other.readwrite
    811 //                 ^^ keyword.operator.type
    812 //                    ^^^^^ keyword.operator.type
    813 //                          ^ meta.brackets support.class
    814 //                            ^ punctuation.section.brackets.end
    815 //                              ^ storage.modifier
    816 //                                ^ storage.modifier.optional
    817 //                                  ^ punctuation.separator.type
    818 //                                    ^ support.class
    819 //                                      ^^^^^ meta.brackets
    820 //                                      ^ punctuation.section.brackets.begin
    821 //                                        ^ support.class
    822 //                                          ^ punctuation.section.brackets.end
    823 //                                            ^ punctuation.separator
    824     
    825     }
    826 //  ^ meta.type punctuation.section.block.end
    827 
    828 let x: ( foo ? : any ) => bar;
    829 //     ^^^^^^^^^^^^^^^^^^^^^^ meta.type
    830 //     ^^^^^^^^^^^^^^^ meta.group
    831 //     ^ punctuation.section.group.begin
    832 //       ^^^ variable.parameter - support.class
    833 //           ^ storage.modifier.optional
    834 //             ^ punctuation.separator.type
    835 //               ^^^ support.type.any
    836 //                   ^ punctuation.section.group.end
    837 //                     ^^ keyword.declaration.function
    838 //                        ^^^ support.class
    839 
    840 let x: ( ... foo : any ) => any;
    841 //     ^^^^^^^^^^^^^^^^^^^^^^^^ meta.type
    842 //     ^^^^^^^^^^^^^^^^^ meta.group
    843 //       ^^^ keyword.operator.spread
    844 //           ^^^ variable.parameter
    845 //               ^ punctuation.separator.type
    846 //                 ^^^ support.type.any
    847 
    848 let x: () => T
    849     U
    850 //  ^ variable.other.constant - meta.type
    851 
    852 let x: new () => T;
    853 //     ^^^^^^^^^^^ meta.type
    854 //     ^^^ keyword.operator.new
    855 //         ^^ meta.group
    856 //            ^^ keyword.declaration.function
    857 //               ^ support.class
    858 
    859 let x: abstract new () => T;
    860 //     ^^^^^^^^^^^^^^^^^^^^ meta.type
    861 //     ^^^^^^^^ storage.modifier.abstract
    862 //              ^^^ keyword.operator.new
    863 //                  ^^ meta.group
    864 //                     ^^ keyword.declaration.function
    865 //                        ^ support.class
    866 
    867 let x: ( foo );
    868 //     ^^^^^^^ meta.type meta.group
    869 //     ^ punctuation.section.group.begin
    870 //       ^^^ support.class
    871 //           ^ punctuation.section.group.end
    872 
    873 let x: T extends U ? V : W;
    874 //     ^^^^^^^^^^^^^^^^^^^ meta.type
    875 //     ^ support.class
    876 //       ^^^^^^^ keyword.operator.type.extends
    877 //               ^ support.class
    878 //                 ^ keyword.operator.type
    879 //                   ^ support.class
    880 //                     ^ keyword.operator.type
    881 //                       ^ support.class
    882 
    883 let x: T extends infer U ? V : W;
    884 //     ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.type
    885 //     ^ support.class
    886 //       ^^^^^^^ keyword.operator.type.extends
    887 //               ^^^^^ keyword.operator.type
    888 //                     ^ support.class
    889 //                       ^ keyword.operator.type
    890 //                         ^ support.class
    891 //                           ^ keyword.operator.type
    892 //                             ^ support.class
    893 
    894 let x: import ( "foo" ) . Bar ;
    895 //     ^^^^^^^^^^^^^^^^^^^^^^^ meta.type
    896 //     ^^^^^^ keyword.operator.type
    897 //            ^^^^^^^^^ meta.group
    898 //            ^ punctuation.section.group.begin
    899 //              ^^^^^ meta.string string.quoted.double
    900 //                    ^ punctuation.section.group.end
    901 //                      ^ punctuation.accessor
    902 //                        ^^^ support.class
    903 
    904     foo < bar > ();
    905 //  ^^^ variable.function
    906 //      ^^^^^^^ meta.generic
    907 //      ^ punctuation.definition.generic.begin
    908 //        ^^^ support.class
    909 //            ^ punctuation.definition.generic.end
    910 //              ^^ meta.group
    911 
    912     foo < bar
    913 //  ^^^ variable.other.readwrite
    914 //      ^ keyword.operator.comparison
    915 //        ^^^ variable.other.readwrite
    916     ;
    917 
    918     new Foo<bar>;
    919 //  ^^^ keyword.operator.word.new
    920 //      ^^^ variable.other.constant
    921 //         ^^^^^ meta.generic
    922 
    923     foo<bar>``;
    924 //  ^^^ variable.other.readwrite
    925 //     ^^^^^ meta.generic
    926 //          ^^ meta.string string.quoted.other
    927 
    928 var foo = 1 << 0 /x/g;
    929 //          ^^ keyword.operator.bitwise
    930 //               ^ keyword.operator.arithmetic
    931 //                ^ variable.other.readwrite
    932 //                 ^ keyword.operator.arithmetic
    933 //                  ^ variable.other.readwrite
    934 
    935 if (a < b || c <= d) {}
    936 //    ^ keyword.operator.comparison
    937 //        ^^ keyword.operator.logical
    938 //             ^^ keyword.operator.comparison
    939 
    940 const f = (): any => {};
    941 //    ^ meta.binding.name entity.name.function variable.other.readwrite
    942 //     ^^^^^^^^^^^^^^^^^^ - entity.name.function
    943 
    944     a != b;
    945 //    ^^ keyword.operator.comparison
    946 
    947 const x = {
    948     readonly: true,
    949 //  ^^^^^^^^ meta.mapping.key
    950     readonly readonly: true,
    951 //  ^^^^^^^^ storage.modifier
    952 //           ^^^^^^^^ meta.mapping.key
    953 
    954     readonly,
    955 //  ^^^^^^^^ variable.other.readwrite
    956 
    957     readonly get() {},
    958 //  ^^^^^^^^ storage.modifier
    959 //           ^^^ entity.name.function
    960 
    961     readonly get foo() {},
    962 //  ^^^^^^^^ storage.modifier
    963 //           ^^^ storage.type.accessor
    964 //               ^^^ entity.name.function
    965 
    966     readonly get: 42,
    967 //  ^^^^^^^^ storage.modifier
    968 //           ^^^ meta.mapping.key
    969 
    970     readonly get,
    971 //  ^^^^^^^^ storage.modifier
    972 //           ^^^ variable.other.readwrite
    973 }