{"action":"created","issue":{"url":"https://api.github.com/repos/google/closure-compiler/issues/2106","repository_url":"https://api.github.com/repos/google/closure-compiler","labels_url":"https://api.github.com/repos/google/closure-compiler/issues/2106/labels{/name}","comments_url":"https://api.github.com/repos/google/closure-compiler/issues/2106/comments","events_url":"https://api.github.com/repos/google/closure-compiler/issues/2106/events","html_url":"https://github.com/google/closure-compiler/issues/2106","id":185466928,"number":2106,"title":"Support expression in extends clauses","user":{"login":"justinfagnani","id":522948,"avatar_url":"https://avatars.githubusercontent.com/u/522948?v=3","gravatar_id":"","url":"https://api.github.com/users/justinfagnani","html_url":"https://github.com/justinfagnani","followers_url":"https://api.github.com/users/justinfagnani/followers","following_url":"https://api.github.com/users/justinfagnani/following{/other_user}","gists_url":"https://api.github.com/users/justinfagnani/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfagnani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfagnani/subscriptions","organizations_url":"https://api.github.com/users/justinfagnani/orgs","repos_url":"https://api.github.com/users/justinfagnani/repos","events_url":"https://api.github.com/users/justinfagnani/events{/privacy}","received_events_url":"https://api.github.com/users/justinfagnani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-26T18:03:00Z","updated_at":"2016-10-26T18:23:45Z","closed_at":null,"body":"[Demo](https://closure-compiler.appspot.com/home#code%3D%252F%252F%2520%253D%253DClosureCompiler%253D%253D%250A%252F%252F%2520%2540compilation_level%2520ADVANCED_OPTIMIZATIONS%250A%252F%252F%2520%2540output_file_name%2520default.js%250A%252F%252F%2520%253D%253D%252FClosureCompiler%253D%253D%250A%250Afunction%2520Mixin(superclass)%2520%257B%250A%2520%2520return%2520class%2520extends%2520superclass%2520%257B%250A%2520%2520%2520%2520constructor()%2520%257B%250A%2520%2520%2520%2520%2520%2520super()%253B%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%252F**%2520%2540param%2520%257Bnumber%257D%2520n%2520*%252F%250A%2520%2520%2520%2520foo(n)%2520%257B%250A%2520%2520%2520%2520%2520%2520console.log(%2560foo%253A%2520%2524%257Bn%257D%2560)%253B%250A%2520%2520%2520%2520%257D%250A%2520%2520%257D%250A%257D%250A)\r\n\r\nClasses can extend arbitrary expressions, but Closure is throwing a warning on an unknown type.\r\n\r\n```javascript\r\nconst Mixin = (superclass) => class extends superclass {\r\n  // ...\r\n}\r\n```\r\n\r\nNote, the warning from the compiler service at least doesn't have a line number:\r\n\r\n```\r\nJSC_TYPE_PARSE_ERROR: Bad type annotation. Unknown type superclass at line -1 beyond character 1\r\n```"},"comment":{"url":"https://api.github.com/repos/google/closure-compiler/issues/comments/256435165","html_url":"https://github.com/google/closure-compiler/issues/2106#issuecomment-256435165","issue_url":"https://api.github.com/repos/google/closure-compiler/issues/2106","id":256435165,"user":{"login":"justinfagnani","id":522948,"avatar_url":"https://avatars.githubusercontent.com/u/522948?v=3","gravatar_id":"","url":"https://api.github.com/users/justinfagnani","html_url":"https://github.com/justinfagnani","followers_url":"https://api.github.com/users/justinfagnani/followers","following_url":"https://api.github.com/users/justinfagnani/following{/other_user}","gists_url":"https://api.github.com/users/justinfagnani/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfagnani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfagnani/subscriptions","organizations_url":"https://api.github.com/users/justinfagnani/orgs","repos_url":"https://api.github.com/users/justinfagnani/repos","events_url":"https://api.github.com/users/justinfagnani/events{/privacy}","received_events_url":"https://api.github.com/users/justinfagnani/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T18:23:45Z","updated_at":"2016-10-26T18:23:45Z","body":"I was going to file separate issues for each aspect of this pattern that fails, but maybe it's easier if they are together.\r\n\r\nAnother problem is that I can't type a mixin _application_ as extending a specific superclass and adding it's own properties:\r\n\r\nGiven a normal class `Base`, and a mixin function `Mixin` that returns a subclass with `bar`, I've tried to type an application like so:\r\n\r\n```javascript\r\n/**\r\n * @constructor\r\n * @extends {Base}\r\n * @typedef {{\r\n *   bar: function(number)\r\n * }}\r\n */\r\nlet MixedBase = Mixin(Base);\r\n```\r\n\r\nClosure gives an error:\r\n\r\n```\r\nJSC_TYPE_PARSE_ERROR: Bad type annotation. type annotation incompatible with other annotations. See https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation for more information. at line 33 character 3\r\n * @typedef {{\r\n   ^\r\n```"}}
{"actor":{"display_login":"justinfagnani"}}