{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/react-proxy/issues/41","repository_url":"https://api.github.com/repos/gaearon/react-proxy","labels_url":"https://api.github.com/repos/gaearon/react-proxy/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/react-proxy/issues/41/comments","events_url":"https://api.github.com/repos/gaearon/react-proxy/issues/41/events","html_url":"https://github.com/gaearon/react-proxy/issues/41","id":131891524,"number":41,"title":"Cannot proxy classes without transpiling them","user":{"login":"akorchev","id":454726,"avatar_url":"https://avatars.githubusercontent.com/u/454726?v=3","gravatar_id":"","url":"https://api.github.com/users/akorchev","html_url":"https://github.com/akorchev","followers_url":"https://api.github.com/users/akorchev/followers","following_url":"https://api.github.com/users/akorchev/following{/other_user}","gists_url":"https://api.github.com/users/akorchev/gists{/gist_id}","starred_url":"https://api.github.com/users/akorchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akorchev/subscriptions","organizations_url":"https://api.github.com/users/akorchev/orgs","repos_url":"https://api.github.com/users/akorchev/repos","events_url":"https://api.github.com/users/akorchev/events{/privacy}","received_events_url":"https://api.github.com/users/akorchev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gaearon/react-proxy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-06T19:37:38Z","updated_at":"2016-02-06T19:45:05Z","closed_at":null,"body":"Currently it throws `Class constructors cannot be invoked without 'new'`. I [forked](https://github.com/akorchev/react-proxy/commit/0b962f4cde28c14addb4e0773f54f4d689c8ad74) the project to show the problem. Unfortunately I failed to find a fix. The implementation relies a lot on \"classic\" prototype inheritance and instantiating objects with `CurrentComponent.apply(this, arguments)`. The best I could get was instantiating a `CurrentComponent` and copying its properties to `this`:\r\n\r\n```\r\n ProxyComponent = function () {\r\n    const current = new CurrentComponent(...arguments);\r\n\r\n    Object.getOwnPropertyNames(current).forEach(property => {\r\n      if (RESERVED_STATICS.indexOf(property) > -1) {\r\n        return;\r\n      }\r\n      if (typeof current[property] !== 'function') {\r\n        this[property] = current[property];\r\n      }\r\n    });\r\n  };\r\n```\r\n\r\nThen only 7 tests failed. Still not a fix though."},"comment":{"url":"https://api.github.com/repos/gaearon/react-proxy/issues/comments/180845564","html_url":"https://github.com/gaearon/react-proxy/issues/41#issuecomment-180845564","issue_url":"https://api.github.com/repos/gaearon/react-proxy/issues/41","id":180845564,"user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"created_at":"2016-02-06T19:45:05Z","updated_at":"2016-02-06T19:45:05Z","body":"I don’t have a deep knowledge of ES6 classes but I still don’t see why they you’d *have* to use `extends`. Can you please clarify what happens if you change the code to call `return new CurrentComponent(...arguments)`?"}}