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
I just found the following bug in some of my TypeScript code:
myArray.push();
This was a typo, and I had actually intended to write:
myArray.push(foo);
I can't imagine that a JavaScript/TypeScript programmer would ever intend to call the push method with 0 arguments.
Thus, it seems to me that this would always be a bug.
Subsequently, some kind of linter rule should automatically catch this bug.
Fail
myArray.push();
Pass
myArray.push(1);
// Even though the array is empty, this still does not count as an "empty" array push,// because we are still explicitly providing at least one argumentconstanotherArray=[];myArray.push(...anotherArray);
The text was updated successfully, but these errors were encountered:
I just found the following bug in some of my TypeScript code:
This was a typo, and I had actually intended to write:
I can't imagine that a JavaScript/TypeScript programmer would ever intend to call the
push
method with 0 arguments.Thus, it seems to me that this would always be a bug.
Subsequently, some kind of linter rule should automatically catch this bug.
Fail
Pass
The text was updated successfully, but these errors were encountered: