diff --git a/JavaScript/TypeScript.sublime-syntax b/JavaScript/TypeScript.sublime-syntax index 95c49e80c0..81919451f9 100644 --- a/JavaScript/TypeScript.sublime-syntax +++ b/JavaScript/TypeScript.sublime-syntax @@ -847,12 +847,10 @@ contexts: - include: immediately-pop ts-type-expression-end: - - match: (?=\|\||&&) - fail: ts-function-type-arguments - - match: \& + - match: \&(?!\&) scope: keyword.operator.type.intersection.js push: [ts-type-expression-end-no-line-terminator, ts-type-expression-begin] - - match: \| + - match: \|(?!\|) scope: keyword.operator.type.union.js push: [ts-type-expression-end-no-line-terminator, ts-type-expression-begin] - match: is{{identifier_break}} diff --git a/JavaScript/tests/syntax_test_typescript.ts b/JavaScript/tests/syntax_test_typescript.ts index aa1c815536..14e8916b6e 100644 --- a/JavaScript/tests/syntax_test_typescript.ts +++ b/JavaScript/tests/syntax_test_typescript.ts @@ -391,6 +391,26 @@ import foo; declare(); // ^^^^^^^ meta.function-call variable.function + declare(); +// ^^^ meta.generic +// ^ punctuation.definition.generic.begin +// ^ support.class +// ^ punctuation.definition.generic.end + + declare(); +// ^^^^^^^^^ meta.generic.js +// ^ punctuation.definition.generic.begin.js +// ^^ support.class.js +// ^ keyword.operator.type.intersection.js +// ^^ support.class.js +// ^ punctuation.definition.generic.end.js + + declare(); +// ^^^^^^^^^^ - meta.generic + + declare>(); +// ^^^^^^^^^^^^^^^^^^^ - meta.generic + declare con; // ^^^^^^^ storage.modifier