{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/24795","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/24795/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/24795/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/24795/events","html_url":"https://github.com/Microsoft/TypeScript/issues/24795","id":330645543,"node_id":"MDU6SXNzdWUzMzA2NDU1NDM=","number":24795,"title":"No errors, if a function returns wrong `Partial`.","user":{"login":"RubaXa","id":1109562,"node_id":"MDQ6VXNlcjExMDk1NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/1109562?v=4","gravatar_id":"","url":"https://api.github.com/users/RubaXa","html_url":"https://github.com/RubaXa","followers_url":"https://api.github.com/users/RubaXa/followers","following_url":"https://api.github.com/users/RubaXa/following{/other_user}","gists_url":"https://api.github.com/users/RubaXa/gists{/gist_id}","starred_url":"https://api.github.com/users/RubaXa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RubaXa/subscriptions","organizations_url":"https://api.github.com/users/RubaXa/orgs","repos_url":"https://api.github.com/users/RubaXa/repos","events_url":"https://api.github.com/users/RubaXa/events{/privacy}","received_events_url":"https://api.github.com/users/RubaXa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-06-08T12:50:01Z","updated_at":"2018-06-08T13:11:18Z","closed_at":"2018-06-08T13:11:18Z","author_association":"NONE","body":"**TypeScript Version:**  2.9.1-insiders.20180525\r\n**Search Terms:** function retrurns Partial\r\n**Code**\r\n\r\n```ts\r\ntype Data = {\r\n    name: string\r\n    value: string;\r\n}\r\n\r\nfunction test(fn: () => Partial<Data>) {\r\n}\r\n\r\n // (1) Correct behavior  \r\nconst obj: Partial<Data> = {\r\n    name: 'foo',\r\n    unknownProp: 'ok',     //     <--- Type is not assignable to type 'Partial<Data>'\r\n};\r\n\r\n// (2) Correct behavior\r\ntest(() => ({\r\n    unknownProp: 'ok',     //     <--- Type is not assignable to type 'Partial<Data>'\r\n}));\r\n\r\n// (3) Incorrect behavior (!!!)\r\ntest(() => ({\r\n    name: 'foo',\r\n    unknownProp: 'wrong',  //     <--- No errors\r\n}));\r\n```\r\n\r\n**Expected behavior:**\r\nIn 3rd example must be the error: `Type { name: string; unknownProp: string; } is not assignable to type 'Partial<Data>'`\r\n\r\n**Actual behavior:**\r\nNo errors\r\n\r\n**Playground Link:** http://www.typescriptlang.org/play/#src=type%20Data%20%3D%20%7B%0D%0A%20%20%20%20name%3A%20string%0D%0A%20%20%20%20value%3A%20string%3B%0D%0A%7D%0D%0A%0D%0Afunction%20test(fn%3A%20()%20%3D%3E%20Partial%3CData%3E)%20%7B%0D%0A%7D%0D%0A%0D%0A%20%2F%2F%20(1)%20Correct%20behavior%20%20%0D%0Aconst%20obj%3A%20Partial%3CData%3E%20%3D%20%7B%0D%0A%20%20%20%20name%3A%20'foo'%2C%0D%0A%20%20%20%20unknownProp%3A%20'ok'%2C%20%2F%2F%20Error%3A%20Type%20is%20not%20assignable%20to%20type%20'Partial%3CData%3E'%0D%0A%7D%3B%0D%0A%0D%0A%2F%2F%20(2)%20Correct%20behavior%0D%0Atest(()%20%3D%3E%20(%7B%0D%0A%20%20%20%20unknownProp%3A%20'ok'%2C%20%2F%2F%20Error%3A%20Type%20is%20not%20assignable%20to%20type%20'Partial%3CData%3E'%0D%0A%7D))%3B%0D%0A%0D%0A%2F%2F%20(3)%20Incorrect%20behavior%20(!!!)%0D%0Atest(()%20%3D%3E%20(%7B%0D%0A%20%20%20%20name%3A%20'foo'%2C%0D%0A%20%20%20%20unknownProp%3A%20'wrong'%2C%20%2F%2F%20No%20errors%0D%0A%7D))%3B%0D%0A"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/395756119","html_url":"https://github.com/Microsoft/TypeScript/issues/24795#issuecomment-395756119","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/24795","id":395756119,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTc1NjExOQ==","user":{"login":"RubaXa","id":1109562,"node_id":"MDQ6VXNlcjExMDk1NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/1109562?v=4","gravatar_id":"","url":"https://api.github.com/users/RubaXa","html_url":"https://github.com/RubaXa","followers_url":"https://api.github.com/users/RubaXa/followers","following_url":"https://api.github.com/users/RubaXa/following{/other_user}","gists_url":"https://api.github.com/users/RubaXa/gists{/gist_id}","starred_url":"https://api.github.com/users/RubaXa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RubaXa/subscriptions","organizations_url":"https://api.github.com/users/RubaXa/orgs","repos_url":"https://api.github.com/users/RubaXa/repos","events_url":"https://api.github.com/users/RubaXa/events{/privacy}","received_events_url":"https://api.github.com/users/RubaXa/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T13:11:18Z","updated_at":"2018-06-08T13:11:18Z","author_association":"NONE","body":"Just describing types is not an option, it's easier for me to refactor code to like this:\r\n```ts\r\ntype Data = {\r\n    name: string\r\n    value: string;\r\n}\r\n\r\nfunction test(fn: (apply: (patch: Partial<Data>) => void) => void) { /* ... */}\r\n\r\n// (2) Correct behavior\r\ntest((apply) => apply({\r\n    unknownProp: 'ok',\r\n}));\r\n\r\n// (3) Correct behavior [FIXED]\r\ntest((apply) => apply({\r\n    name: 'foo',\r\n    unknownProp: 'wrong',\r\n}));\r\n```"}}
{"actor":{"display_login":"RubaXa"}}