{"action":"closed","issue":{"url":"https://api.github.com/repos/angular/clutz/issues/306","repository_url":"https://api.github.com/repos/angular/clutz","labels_url":"https://api.github.com/repos/angular/clutz/issues/306/labels{/name}","comments_url":"https://api.github.com/repos/angular/clutz/issues/306/comments","events_url":"https://api.github.com/repos/angular/clutz/issues/306/events","html_url":"https://github.com/angular/clutz/issues/306","id":165869908,"number":306,"title":"Generate optional properties from `<type>|undefined`","user":{"login":"gmoothart","id":3227,"avatar_url":"https://avatars.githubusercontent.com/u/3227?v=3","gravatar_id":"","url":"https://api.github.com/users/gmoothart","html_url":"https://github.com/gmoothart","followers_url":"https://api.github.com/users/gmoothart/followers","following_url":"https://api.github.com/users/gmoothart/following{/other_user}","gists_url":"https://api.github.com/users/gmoothart/gists{/gist_id}","starred_url":"https://api.github.com/users/gmoothart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmoothart/subscriptions","organizations_url":"https://api.github.com/users/gmoothart/orgs","repos_url":"https://api.github.com/users/gmoothart/repos","events_url":"https://api.github.com/users/gmoothart/events{/privacy}","received_events_url":"https://api.github.com/users/gmoothart/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-15T20:21:32Z","updated_at":"2016-08-02T22:37:40Z","closed_at":"2016-08-02T22:37:40Z","body":"In our closure typedefs, we use `type|undefined` to represent an object property that is optional.\r\nAn example is the \"parent\" property here:\r\n\r\n```\r\ngoog.provide('organization.OrganizationData');\r\n\r\n/** @record */\r\norganization.OrganizationData = function() {};\r\n\r\n/** @export {string} */\r\norganization.OrganizationData.prototype.key;\r\n\r\n/** @export {string} */\r\norganization.OrganizationData.prototype.name;\r\n\r\n/** @export {!organization.OrganizationData|undefined} */\r\norganization.OrganizationData.prototype.parent;\r\n```\r\n\r\nWhen clutz runs over this file, it just copies over the \"| undefined\" and produces:\r\n```\r\n  interface OrganizationData {\r\n    key : string ;\r\n    name : string ;\r\n    parent : ಠ_ಠ.clutz.organization.OrganizationData | undefined ;\r\n  }\r\n```\r\nWhen I create a variable of type OrganizationData, typescript insists that I include the optional properties as well. I think it would be better for clutz to special-case this and output optional properties - like \"parent?\" - instead."}}
{"actor":{"display_login":"rkirov"}}