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
When define a const Array type, its Array.length type also be the constant value. However, type of Array.length - 1 is not the constant value because TypeScript does not support minus operation between const number types.
Thus, I hope TypeScript to support the simple arithmetic operations on the const number types.
typeSomeNumber=3;typeSomeOperatedNumber=3-1;// NOT POSSIBLEfunctionmain(): void{letsomeArray: [number,string,false]=[1,"something",false];letlength: 3=someArray.length;letlastIndex: number=someArray.length-1;// not 2, but number}
The text was updated successfully, but these errors were encountered:
When define a const
Array
type, itsArray.length
type also be the constant value. However, type ofArray.length - 1
is not the constant value because TypeScript does not support minus operation between const number types.Thus, I hope TypeScript to support the simple arithmetic operations on the const number types.
The text was updated successfully, but these errors were encountered: