-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Array.prototype.slice() returns this #5123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @sandersn, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
👍 |
// Array.prototype.slice returns this with zero arguments, allowing tuple slicing | ||
let t1: [number, number] = [1, 2]; | ||
let t2: [number, number] = t1.slice(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add these test as well
let t3:[number, number] = t1.slice(0);
let t3:[number, number] = t1.slice(0,1);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, although those are negative tests -- only slice() returns this
.
These are negative test cases; `slice(begin,end)` doesn't return `this` because `(begin,end)` specify a *different* tuple type, which the compiler is not prepared to infer.
is this ready to go? |
No, I think it's superceded by my upcoming tuple kind proposal. @DanielRosenwasser and @ahejlsberg pointed out some problems in the discussion on #4988 -- specifically, that |
let's close it then. |
Fixes #4988