You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be nice if there was an error during the assignment, is Number also a number? Another option is error 2363 could mention this potential issue. E.g.
The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. Not 'Number' .ts(2363)
And replace 'Number' with whatever type was actually found.
📃 Motivating Example
const x: Number = 5;
const y = 5 - x;
Minor typos should have a clear error message.
The text was updated successfully, but these errors were encountered:
I don't think the the first letter capitalization is the only problem. Consider Playground:
constx: Number=1;consty: Number=2;constz=x+y;// Operator '+' cannot be applied to types 'Number' and 'Number'.consta: BigInt=1n;constb: BigInt=2n;constc=a+b;// Operator '+' cannot be applied to types 'BigInt' and 'BigInt'
So here the types are exactly the same, both starting with upper case, and still TS is complaining. This is very confusing.
I think this issue would be solved when #2361 is solved, it's not an exact duplicate though.
Suggestion
The following code errors:
With this:
Which is super confusing because it is a number. But I didn't realize the problem was the first letter capitalization.
Number
vsnumber
.🔍 Search Terms
right-hand side of an arithmetic
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Would be nice if there was an error during the assignment, is
Number
also anumber
? Another option is error 2363 could mention this potential issue. E.g.And replace 'Number' with whatever type was actually found.
📃 Motivating Example
Minor typos should have a clear error message.
The text was updated successfully, but these errors were encountered: