Skip to content

typeof with < breaks syntax highlighting #978

@j4k0xb

Description

@j4k0xb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions