Skip to content

Operator '<' cannot be applied to types 'boolean' and 'never'. #62149

@na7ure-a

Description

@na7ure-a

🔎 Search Terms

Operator '<' cannot be applied to types 'boolean' and 'never'.

🕗 Version & Regression Information

  • This changed between versions 4.9.5 and 5.0.4

⏯ Playground Link

https://www.typescriptlang.org/zh/play/?target=7&ts=5.0.4#code/DYUwLgBAhhC8EDMrAM4gLAChSQEZ0WTSwHoSIBRAJyoHsqIqQAHesASwDsBzCFdsAFcoHWpyw5GIFAXwAyORAAUMADwRcASlLkA8mAAWIBp3oBbZBADG7KlcFmUYKJyvSs+eGCqCMmJjLw8ooqEOpaWAEESKggEArKahqaQA

💻 Code

let a = false
let b = false
// Error reporting situation
let res = b && (a < b)
// Other normal circumstances
b = true
res = b && (a < b)
res = false && (a < b)

🙁 Actual behavior

There were no errors before version 4.9.5
An error occurred after version 5.0.4

🙂 Expected behavior

This error should not be reported

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions