{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/polyfills/issues/24","repository_url":"https://api.github.com/repos/aurelia/polyfills","labels_url":"https://api.github.com/repos/aurelia/polyfills/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/polyfills/issues/24/comments","events_url":"https://api.github.com/repos/aurelia/polyfills/issues/24/events","html_url":"https://github.com/aurelia/polyfills/issues/24","id":151912499,"number":24,"title":"Reflect.getOwnMetadata gets metadata for parents in Typescript","user":{"login":"doktordirk","id":13430091,"avatar_url":"https://avatars.githubusercontent.com/u/13430091?v=3","gravatar_id":"","url":"https://api.github.com/users/doktordirk","html_url":"https://github.com/doktordirk","followers_url":"https://api.github.com/users/doktordirk/followers","following_url":"https://api.github.com/users/doktordirk/following{/other_user}","gists_url":"https://api.github.com/users/doktordirk/gists{/gist_id}","starred_url":"https://api.github.com/users/doktordirk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doktordirk/subscriptions","organizations_url":"https://api.github.com/users/doktordirk/orgs","repos_url":"https://api.github.com/users/doktordirk/repos","events_url":"https://api.github.com/users/doktordirk/events{/privacy}","received_events_url":"https://api.github.com/users/doktordirk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-04-29T16:27:56Z","updated_at":"2016-05-02T15:23:13Z","closed_at":null,"body":"edit:\r\nCurrent Reflect polyfill doesn work for child classes in typescript since Object.hasOwnProperty(key) returns the parent if applicable\r\n\r\n--------\r\nold message:\r\n @cmichaelgraham following up on https://github.com/aurelia/metadata/pull/33\r\n```js\r\nclass x {\r\n  meta;\r\n}\r\nclass y extends x{}\r\n```\r\ny.hasOwnProperty('meta') should be false. \r\n\r\nthis works as specified in es6 but not for typescript where current version yields true. \r\n\r\nhttps://github.com/aurelia/polyfills/blob/master/src/reflect.js#L21\r\n```js\r\nlet metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : (target[metadataContainerKey] = {});\r\nlet targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {}); \r\n```\r\nif target.hasOwnProperty gives wrongly true for child classes, the parent target[metadataContainerKey] is used for metadataContainer. and since  targetKey is undefined and the parent has a  metadataContainer['undefined'] the parents  targetContainer  is used instead of a new one.\r\n\r\nsorry if i'm not clear enough, but finding the issue wasn't particular easy. m mushy in the head.\r\npoint begin: hasOwnProperty isn't behaving right for TS"},"comment":{"url":"https://api.github.com/repos/aurelia/polyfills/issues/comments/216266110","html_url":"https://github.com/aurelia/polyfills/issues/24#issuecomment-216266110","issue_url":"https://api.github.com/repos/aurelia/polyfills/issues/24","id":216266110,"user":{"login":"doktordirk","id":13430091,"avatar_url":"https://avatars.githubusercontent.com/u/13430091?v=3","gravatar_id":"","url":"https://api.github.com/users/doktordirk","html_url":"https://github.com/doktordirk","followers_url":"https://api.github.com/users/doktordirk/followers","following_url":"https://api.github.com/users/doktordirk/following{/other_user}","gists_url":"https://api.github.com/users/doktordirk/gists{/gist_id}","starred_url":"https://api.github.com/users/doktordirk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doktordirk/subscriptions","organizations_url":"https://api.github.com/users/doktordirk/orgs","repos_url":"https://api.github.com/users/doktordirk/repos","events_url":"https://api.github.com/users/doktordirk/events{/privacy}","received_events_url":"https://api.github.com/users/doktordirk/received_events","type":"User","site_admin":false},"created_at":"2016-05-02T15:23:13Z","updated_at":"2016-05-02T15:23:13Z","body":"since it's not working for typescript as it is, something has to be done. i see three options:\r\n* tell typescript user to use there own polyfill (though i didn't manage that yet)\r\n* use the implementation from eg https://github.com/gdi2290/es7-reflect-metadata\r\n* make a hacky version by just adding/using `target.name` to/for the target key. (as opposed to leaving the key at `undefined`as per Reflect spez for class metadata, i think)"}}