{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4988","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4988/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4988/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4988/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4988","id":108491990,"number":4988,"title":"Tuples should be clonable with Array.prototype.slice()","user":{"login":"vjau","id":5278429,"avatar_url":"https://avatars.githubusercontent.com/u/5278429?v=3","gravatar_id":"","url":"https://api.github.com/users/vjau","html_url":"https://github.com/vjau","followers_url":"https://api.github.com/users/vjau/followers","following_url":"https://api.github.com/users/vjau/following{/other_user}","gists_url":"https://api.github.com/users/vjau/gists{/gist_id}","starred_url":"https://api.github.com/users/vjau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjau/subscriptions","organizations_url":"https://api.github.com/users/vjau/orgs","repos_url":"https://api.github.com/users/vjau/repos","events_url":"https://api.github.com/users/vjau/events{/privacy}","received_events_url":"https://api.github.com/users/vjau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/lib.d.ts","name":"lib.d.ts","color":"c7def8"}],"state":"closed","locked":false,"assignee":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/15","html_url":"https://github.com/Microsoft/TypeScript/milestones/TypeScript%201.8","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/15/labels","id":1347987,"number":15,"title":"TypeScript 1.8","description":"","creator":{"login":"mhegazy","id":8000722,"avatar_url":"https://avatars.githubusercontent.com/u/8000722?v=3","gravatar_id":"","url":"https://api.github.com/users/mhegazy","html_url":"https://github.com/mhegazy","followers_url":"https://api.github.com/users/mhegazy/followers","following_url":"https://api.github.com/users/mhegazy/following{/other_user}","gists_url":"https://api.github.com/users/mhegazy/gists{/gist_id}","starred_url":"https://api.github.com/users/mhegazy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhegazy/subscriptions","organizations_url":"https://api.github.com/users/mhegazy/orgs","repos_url":"https://api.github.com/users/mhegazy/repos","events_url":"https://api.github.com/users/mhegazy/events{/privacy}","received_events_url":"https://api.github.com/users/mhegazy/received_events","type":"User","site_admin":false},"open_issues":188,"closed_issues":50,"state":"open","created_at":"2015-10-09T22:07:47Z","updated_at":"2015-11-11T21:13:56Z","due_on":null,"closed_at":null},"comments":14,"created_at":"2015-09-26T19:57:49Z","updated_at":"2015-11-11T21:13:56Z","closed_at":"2015-11-11T21:13:56Z","body":"Let's say i define a tuple type like this :\r\n```ts\r\ntype MyTuple = [number, number]\r\n```\r\n\r\nNow when i do this:\r\n```ts\r\nlet a: MyTuple = [1, 2]\r\nlet b: MyTuple = a.slice();\r\n```\r\n\r\nThe compiler complains that `TS2322: Type 'number[]' is not assignable to type '[number, number]'.\r\n Property '0' is missing in type 'number[]'.`\r\n\r\nI think it should work, slice without argument (or slice(0) or even slice(0,2)) should allow to clone a tuple.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/155912354","html_url":"https://github.com/Microsoft/TypeScript/issues/4988#issuecomment-155912354","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4988","id":155912354,"user":{"login":"sandersn","id":293473,"avatar_url":"https://avatars.githubusercontent.com/u/293473?v=3","gravatar_id":"","url":"https://api.github.com/users/sandersn","html_url":"https://github.com/sandersn","followers_url":"https://api.github.com/users/sandersn/followers","following_url":"https://api.github.com/users/sandersn/following{/other_user}","gists_url":"https://api.github.com/users/sandersn/gists{/gist_id}","starred_url":"https://api.github.com/users/sandersn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandersn/subscriptions","organizations_url":"https://api.github.com/users/sandersn/orgs","repos_url":"https://api.github.com/users/sandersn/repos","events_url":"https://api.github.com/users/sandersn/events{/privacy}","received_events_url":"https://api.github.com/users/sandersn/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T21:13:56Z","updated_at":"2015-11-11T21:13:56Z","body":"Closing for now -- we should revisit once we have variadic kinds for tuple types so that there is at least a chance to write a type like:\r\n\r\n```ts\r\ninterface Array<T> {\r\n   slice<...U>(): ...U;\r\n}\r\n```\r\n\r\n...although I'm still not sure how to relate `T` and `...U` here."}}