{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25041","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25041/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25041/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25041/events","html_url":"https://github.com/Microsoft/TypeScript/issues/25041","id":333290724,"node_id":"MDU6SXNzdWUzMzMyOTA3MjQ=","number":25041,"title":"in typescript 2.8, a common definition of Omit causes declarations that don't compile to be generated","user":{"login":"blushingpenguin","id":357947,"node_id":"MDQ6VXNlcjM1Nzk0Nw==","avatar_url":"https://avatars3.githubusercontent.com/u/357947?v=4","gravatar_id":"","url":"https://api.github.com/users/blushingpenguin","html_url":"https://github.com/blushingpenguin","followers_url":"https://api.github.com/users/blushingpenguin/followers","following_url":"https://api.github.com/users/blushingpenguin/following{/other_user}","gists_url":"https://api.github.com/users/blushingpenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/blushingpenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blushingpenguin/subscriptions","organizations_url":"https://api.github.com/users/blushingpenguin/orgs","repos_url":"https://api.github.com/users/blushingpenguin/repos","events_url":"https://api.github.com/users/blushingpenguin/events{/privacy}","received_events_url":"https://api.github.com/users/blushingpenguin/received_events","type":"User","site_admin":false},"labels":[{"id":113970366,"node_id":"MDU6TGFiZWwxMTM5NzAzNjY=","url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Bug","name":"Bug","color":"e11d21","default":false},{"id":670961382,"node_id":"MDU6TGFiZWw2NzA5NjEzODI=","url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Domain:%20Declaration%20Emit","name":"Domain: Declaration Emit","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":{"login":"weswigham","id":2932786,"node_id":"MDQ6VXNlcjI5MzI3ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"assignees":[{"login":"weswigham","id":2932786,"node_id":"MDQ6VXNlcjI5MzI3ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/77","html_url":"https://github.com/Microsoft/TypeScript/milestone/77","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones/77/labels","id":3556985,"node_id":"MDk6TWlsZXN0b25lMzU1Njk4NQ==","number":77,"title":"TypeScript 3.2","description":"Tentative name for the release following TypeScript 3.1","creator":{"login":"RyanCavanaugh","id":6685088,"node_id":"MDQ6VXNlcjY2ODUwODg=","avatar_url":"https://avatars3.githubusercontent.com/u/6685088?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanCavanaugh","html_url":"https://github.com/RyanCavanaugh","followers_url":"https://api.github.com/users/RyanCavanaugh/followers","following_url":"https://api.github.com/users/RyanCavanaugh/following{/other_user}","gists_url":"https://api.github.com/users/RyanCavanaugh/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanCavanaugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanCavanaugh/subscriptions","organizations_url":"https://api.github.com/users/RyanCavanaugh/orgs","repos_url":"https://api.github.com/users/RyanCavanaugh/repos","events_url":"https://api.github.com/users/RyanCavanaugh/events{/privacy}","received_events_url":"https://api.github.com/users/RyanCavanaugh/received_events","type":"User","site_admin":false},"open_issues":144,"closed_issues":15,"state":"open","created_at":"2018-08-08T22:47:52Z","updated_at":"2018-09-13T22:43:35Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-06-18T14:20:18Z","updated_at":"2018-09-13T22:43:57Z","closed_at":null,"author_association":"NONE","body":"**TypeScript Version:**\r\nReproduces with 3.0.0-dev.201xxxxx, 2.9.2, 2.8.4\r\n\r\n**Search terms**\r\nomit, declaration, pick, undefined\r\n\r\n**Example**\r\n```\r\nexport type Omit<T, K extends keyof T> = Pick<T, \r\n    ({ [P in keyof T]: P } & { [P in K]: never } )[keyof T]>;\r\n\r\nexport interface IOmitTest {\r\n\t(): { notSupposedToHappen: Omit<IXProps, \"unwantedProp\"> }\r\n}\r\n\r\nexport interface IXProps {\r\n    optionalProp?: string\r\n    unwantedProp: string\r\n}\r\n\r\nconst Y: IOmitTest = null as any;\r\nexport const Z = Y();\r\n\r\nexport interface IMouseOver {\r\n    wrong: Omit<IXProps, \"unwantedProp\">\r\n}\r\n```\r\n\r\ngenerates\r\n\r\n```\r\nexport declare type Omit<T, K extends keyof T> = Pick<T, ({\r\n    [P in keyof T]: P;\r\n} & {\r\n    [P in K]: never;\r\n})[keyof T]>;\r\nexport interface IOmitTest {\r\n    (): {\r\n        notSupposedToHappen: Omit<IXProps, \"unwantedProp\">;\r\n    };\r\n}\r\nexport interface IXProps {\r\n    optionalProp?: string;\r\n    unwantedProp: string;\r\n}\r\nexport declare const Z: {\r\n    notSupposedToHappen: Pick<IXProps, \"optionalProp\" | undefined>;\r\n};\r\nexport interface IMouseOver {\r\n    wrong: Omit<IXProps, \"unwantedProp\">;\r\n}\r\n```\r\n\r\nThe interface returning a function seems to be required to get typescript to collapse the Omit to a Pick statement (otherwise you just get Omit<IXProps, \"unwatedProp\"> in the declaration file).\r\n\r\nI think this is a bug in typescript because it's produced a declaration file with syntax errors in it.\r\n\r\n**Expected behavior:**\r\nundefined should not be present in the Pick statement\r\n\r\n**Playground Link:** \r\nthe playground does not provide the ability to generate declartions\r\n\r\n**Related Issues:**\r\nhttps://github.com/Microsoft/TypeScript/issues/12215\r\n\r\nnote that if the definition of Omit is replaced with the newer declaration possible in typescript 2.9\r\n```\r\nexport type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>\r\n```\r\n\r\nthen\r\n\r\n```\r\nexport declare const Z: {\r\n    notSupposedToHappen: Pick<IXProps, \"optionalProp\">;\r\n};\r\n```\r\n\r\nresults as expected.\r\n\r\nI actually encountered this issue using when using connect() in react-redux with a component with an optional property, where the definition of Omit is:\r\n\r\n```\r\ntype Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/421175839","html_url":"https://github.com/Microsoft/TypeScript/issues/25041#issuecomment-421175839","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25041","id":421175839,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTE3NTgzOQ==","user":{"login":"weswigham","id":2932786,"node_id":"MDQ6VXNlcjI5MzI3ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2932786?v=4","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T22:43:57Z","updated_at":"2018-09-13T22:43:57Z","author_association":"MEMBER","body":"@RyanCavanaugh we need to consider the implications of fixing this one."}}
{"actor":{"display_login":"weswigham"}}