{"action":"opened","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9453","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9453/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9453/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9453/events","html_url":"https://github.com/Microsoft/TypeScript/issues/9453","id":163264154,"number":9453,"title":"Decorator Type Mismatch?","user":{"login":"skorlir","id":887682,"avatar_url":"https://avatars.githubusercontent.com/u/887682?v=3","gravatar_id":"","url":"https://api.github.com/users/skorlir","html_url":"https://github.com/skorlir","followers_url":"https://api.github.com/users/skorlir/followers","following_url":"https://api.github.com/users/skorlir/following{/other_user}","gists_url":"https://api.github.com/users/skorlir/gists{/gist_id}","starred_url":"https://api.github.com/users/skorlir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skorlir/subscriptions","organizations_url":"https://api.github.com/users/skorlir/orgs","repos_url":"https://api.github.com/users/skorlir/repos","events_url":"https://api.github.com/users/skorlir/events{/privacy}","received_events_url":"https://api.github.com/users/skorlir/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-30T20:50:53Z","updated_at":"2016-06-30T20:50:53Z","closed_at":null,"body":"<!-- BUGS: Please use this template. -->\r\n<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:**  nightly (2.0.0-dev.20160630)\r\n\r\n**Code** (This is a fairly contrived example.)\r\n\r\n```ts\r\nfunction CanRawr (target: (...args: any[]) => Function) : Function {\r\n  class Rawrable extends target {\r\n    static rawr () : void {\r\n      console.log(`RAWR`)\r\n    }\r\n  }\r\n\r\n  return Rawrable\r\n}\r\n\r\n@CanRawr\r\nexport default class Dinosaur { }\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nEverything typechecks.\r\n\r\n**Actual behavior:** \r\n\r\nCode compiles, but logs a hard to diagnose error. Compiled code works as expected.\r\n\r\n```\r\napp/ex.ts(11,2): error TS2345: Argument of type 'typeof Dinosaur' is not assignable to parameter of type 'new (...args: any[]) => Function'.\r\n  Type 'Dinosaur' is not assignable to type 'Function'.\r\n    Property 'apply' is missing in type 'Dinosaur'.\r\n```\r\n\r\nThis is strange - looking at the signature for `ClassDecorator`:\r\n\r\n```ts\r\ndeclare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;\r\n```\r\n\r\nI would think that I am allowed to return a Function in place of a TFunction.\r\n\r\nPerhaps I am doing something wrong? But the code compiles and runs, and does what I expect.\r\n\r\n```ts\r\nimport Dinosaur from './example'\r\n\r\nDinosaur.rawr() // logs: 'RAWR'\r\n```"}}
{"actor":{"display_login":"skorlir"}}