microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
413 stars 126 forks source link

`typeof` with `<` breaks syntax highlighting #978

Open j4k0xb opened 1 year ago

j4k0xb commented 1 year ago

JavaScript and TypeScript Nightly version: v5.1.20230416

Code

typeof x < ''; function f() {}

For context, here's the whole code where I noticed it (common in minified js):

var gt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};

Actual behaviour: typeof with < or <= gets interpreted as the begin of a type parameter and breaks all syntax highlighting after it. image image

Expected behaviour: should be a relational operator. image