{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25754","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25754/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25754/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25754/events","html_url":"https://github.com/Microsoft/TypeScript/issues/25754","id":342215177,"node_id":"MDU6SXNzdWUzNDIyMTUxNzc=","number":25754,"title":"Class decorator works weird with static properties","user":{"login":"zry656565","id":1888508,"node_id":"MDQ6VXNlcjE4ODg1MDg=","avatar_url":"https://avatars0.githubusercontent.com/u/1888508?v=4","gravatar_id":"","url":"https://api.github.com/users/zry656565","html_url":"https://github.com/zry656565","followers_url":"https://api.github.com/users/zry656565/followers","following_url":"https://api.github.com/users/zry656565/following{/other_user}","gists_url":"https://api.github.com/users/zry656565/gists{/gist_id}","starred_url":"https://api.github.com/users/zry656565/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zry656565/subscriptions","organizations_url":"https://api.github.com/users/zry656565/orgs","repos_url":"https://api.github.com/users/zry656565/repos","events_url":"https://api.github.com/users/zry656565/events{/privacy}","received_events_url":"https://api.github.com/users/zry656565/received_events","type":"User","site_admin":false},"labels":[{"id":113971558,"node_id":"MDU6TGFiZWwxMTM5NzE1NTg=","url":"https://api.github.com/repos/Microsoft/TypeScript/labels/Question","name":"Question","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-18T07:51:29Z","updated_at":"2018-07-31T17:10:45Z","closed_at":null,"author_association":"NONE","body":"<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common \"Bugs\" That Aren't Bugs section!\r\n\r\nPlease help us by doing the following steps before logging an issue:\r\n  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues\r\n  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ\r\n\r\nPlease fill in the *entire* template below.\r\n-->\r\n\r\n<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:**  2.9.1-insiders.20180525\r\n\r\n<!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** decorator static\r\n\r\n**Code**\r\n\r\n```ts\r\nfunction logClass(target: any) {\r\n  var original = target;\r\n\r\n  function construct(constructor, args) {\r\n    var c : any = function () {\r\n      return constructor.apply(this, args);\r\n    }\r\n    c.prototype = constructor.prototype;\r\n    return new c();\r\n  }\r\n\r\n  var f : any = function (...args) {\r\n    console.log(\"New: \" + original.name); \r\n    return construct(original, args);\r\n  }\r\n\r\n  f.prototype = original.prototype;\r\n\r\n  return f;\r\n}\r\n\r\n@logClass\r\nclass Profile {\r\n  static initState = 0\r\n\r\n  state: number\r\n\r\n  constructor() {\r\n    console.log(1, Profile);\r\n    this.state = Profile.initState;\r\n    console.log(2, this.state);\r\n  }\r\n}\r\n\r\nconsole.log(3, Profile);\r\nconsole.log(4, new Profile());\r\n```\r\n\r\n**Expected behavior:**\r\n\r\n```ts\r\nconst p = new Profile();\r\np.status;   // 0\r\n```\r\n\r\n**Actual behavior:**\r\n\r\n```ts\r\nconst p = new Profile();\r\np.status;   // undefined\r\n```\r\n\r\n**Playground Link:** <!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\nhttps://www.typescriptlang.org/play/index.html#src=function%20logClass(target%3A%20any)%20%7B%0D%0A%20%20var%20original%20%3D%20target%3B%0D%0A%0D%0A%20%20function%20construct(constructor%2C%20args)%20%7B%0D%0A%20%20%20%20var%20c%20%3A%20any%20%3D%20function%20()%20%7B%0D%0A%20%20%20%20%20%20return%20constructor.apply(this%2C%20args)%3B%0D%0A%20%20%20%20%7D%0D%0A%20%20%20%20c.prototype%20%3D%20constructor.prototype%3B%0D%0A%20%20%20%20return%20new%20c()%3B%0D%0A%20%20%7D%0D%0A%0D%0A%20%20var%20f%20%3A%20any%20%3D%20function%20(...args)%20%7B%0D%0A%20%20%20%20console.log(%22New%3A%20%22%20%2B%20original.name)%3B%20%0D%0A%20%20%20%20return%20construct(original%2C%20args)%3B%0D%0A%20%20%7D%0D%0A%0D%0A%20%20f.prototype%20%3D%20original.prototype%3B%0D%0A%0D%0A%20%20return%20f%3B%0D%0A%7D%0D%0A%0D%0A%40logClass%0D%0Aclass%20Profile%20%7B%0D%0A%20%20static%20initState%20%3D%200%0D%0A%0D%0A%20%20state%3A%20number%0D%0A%0D%0A%20%20constructor()%20%7B%0D%0A%20%20%20%20console.log(1%2C%20Profile)%3B%0D%0A%20%20%20%20this.state%20%3D%20Profile.initState%3B%0D%0A%20%20%20%20console.log(2%2C%20this.state)%3B%0D%0A%20%20%7D%0D%0A%7D%0D%0A%0D%0Aconsole.log(3%2C%20Profile)%3B%0D%0Aconsole.log(4%2C%20new%20Profile())%3B\r\n\r\n**Related Issues:** <!-- Did you find other bugs that looked similar? -->\r\n\r\nhttps://github.com/Microsoft/TypeScript/issues/9868\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/409297114","html_url":"https://github.com/Microsoft/TypeScript/issues/25754#issuecomment-409297114","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/25754","id":409297114,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTI5NzExNA==","user":{"login":"typescript-bot","id":23042052,"node_id":"MDQ6VXNlcjIzMDQyMDUy","avatar_url":"https://avatars0.githubusercontent.com/u/23042052?v=4","gravatar_id":"","url":"https://api.github.com/users/typescript-bot","html_url":"https://github.com/typescript-bot","followers_url":"https://api.github.com/users/typescript-bot/followers","following_url":"https://api.github.com/users/typescript-bot/following{/other_user}","gists_url":"https://api.github.com/users/typescript-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/typescript-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/typescript-bot/subscriptions","organizations_url":"https://api.github.com/users/typescript-bot/orgs","repos_url":"https://api.github.com/users/typescript-bot/repos","events_url":"https://api.github.com/users/typescript-bot/events{/privacy}","received_events_url":"https://api.github.com/users/typescript-bot/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T17:10:45Z","updated_at":"2018-07-31T17:10:45Z","author_association":"COLLABORATOR","body":"Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed."}}
{"actor":{"display_login":"typescript-bot"}}