Bug Report
🔎 Search Terms
Number object
number primitive
binary operator <
ts2365
TypeScript 5.0-dev
🕗 Version & Regression Information
- This changed between versions 4.9.5 and 5.0.0-dev.20230210
⏯ Playground Link
Playground link with relevant code
💻 Code
consta=newNumber(1);constb=2;console.log(a<b)
🙁 Actual behavior
In TypeScript 5.0.0-dev.20230210, it reports error ts2365, but in TypeScript 4.9.5, it doesn't.
🙂 Expected behavior
I'm not sure whether this is a bug of 5.0-dev or a breaking change that which will be introduced in 5.0. If it's a breaking change by design, maybe it should be included in #51362? If not, it should not report any error since it's valid JavaScript code.
Actually, I run into this error when I try to extend Number.prototype for utility:
interfaceNumber{[Symbol.iterator](): Generator<number>;}Number.prototype[Symbol.iterator]=function*(){for(leti=0;i<this;i++)yieldi;// ^^^^^^^^ ts2365}for(constiof10)console.log(i);
Bug Report
🔎 Search Terms
Number object
number primitive
binary operator <
ts2365
TypeScript 5.0-dev
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
In TypeScript 5.0.0-dev.20230210, it reports error
ts2365, but in TypeScript 4.9.5, it doesn't.🙂 Expected behavior
I'm not sure whether this is a bug of 5.0-dev or a breaking change that which will be introduced in 5.0. If it's a breaking change by design, maybe it should be included in #51362? If not, it should not report any error since it's valid JavaScript code.
Actually, I run into this error when I try to extend
Number.prototypefor utility: