microsoft / TypeScript-TmLanguage

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

Syntax highlighting issue using `typeof x extends` without parentheses #907

Closed leonsilicon closed 1 year ago

leonsilicon commented 2 years ago

TS and JS Grammar Extension version: 0.0.55 / latest

Code

const a = 2;
type A = typeof a extends number ? 0 : 1;

// The following highlights correctly
const b = 2;
type B = (typeof b) extends number ? 0 : 1;

I would use parentheses, but unfortunately Prettier automatically removes them.

Screen Shot 2022-04-18 at 7 16 42 PM