Bug Report
🔎 Search Terms
operator cannot be applied enum number comparison
🕗 Version & Regression Information
- This changed between versions 4.9 and 5.0
⏯ Playground Link
Playground Link
💻 Code
constenumConstants{DefaultName="foo",DefaultTimeout=1000,MaxItems=25,}declarevarsomeValue: numberif(someValue>Constants.MaxItems){someValue=Constants.MaxItems;}🙁 Actual behavior
Operator '>' cannot be applied to types 'number' and 'Constants'.(2365)
Removing the string-ish value from Constants stops the error.
🙂 Expected behavior
No error; even though Constants shouldn't be comparable thanks to #52048, this seems like it should work because it's only referencing a specific value.
/cc Mateusz Burzyński (@Andarist)Anders Hejlsberg (@ahejlsberg)
Bug Report
🔎 Search Terms
operator cannot be applied enum number comparison
🕗 Version & Regression Information
⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
Removing the string-ish value from
Constantsstops the error.🙂 Expected behavior
No error; even though
Constantsshouldn't be comparable thanks to #52048, this seems like it should work because it's only referencing a specific value./cc Mateusz Burzyński (@Andarist)Anders Hejlsberg (@ahejlsberg)