microsoft / microsoft/TypeScript-TmLanguage
`typeof` with `<` breaks syntax highlighting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
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.


Expected behaviour: should be a relational operator.

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two TypeScript and JavaScript snippets in the report, beginning with the repository's TextMate grammar. Verify that < and <= after typeof remain highlighted as relational operators and that highlighting continues through the rest of each snippet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100