{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/209","repository_url":"https://api.github.com/repos/gaearon/react-hot-loader","labels_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/209/comments","events_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/209/events","html_url":"https://github.com/gaearon/react-hot-loader/issues/209","id":112970873,"number":209,"title":"Typescript support","user":{"login":"sqrtroot","id":6583557,"avatar_url":"https://avatars.githubusercontent.com/u/6583557?v=3","gravatar_id":"","url":"https://api.github.com/users/sqrtroot","html_url":"https://github.com/sqrtroot","followers_url":"https://api.github.com/users/sqrtroot/followers","following_url":"https://api.github.com/users/sqrtroot/following{/other_user}","gists_url":"https://api.github.com/users/sqrtroot/gists{/gist_id}","starred_url":"https://api.github.com/users/sqrtroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sqrtroot/subscriptions","organizations_url":"https://api.github.com/users/sqrtroot/orgs","repos_url":"https://api.github.com/users/sqrtroot/repos","events_url":"https://api.github.com/users/sqrtroot/events{/privacy}","received_events_url":"https://api.github.com/users/sqrtroot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-23T07:58:01Z","updated_at":"2016-04-17T17:44:57Z","closed_at":"2016-04-17T17:44:57Z","body":"Unfortunatly this plugin doesn't seem to work alright with typescript.\r\nIt hot reloads the render function alright, but functions other then that don't seem to hotreload alright\r\nWhen using this code:\r\n\r\n    export let Timer = React.createClass({\r\n      getInitialState: function() {\r\n        return {secondsElapsed: 0};\r\n      },\r\n      tick: function() {\r\n        this.setState({secondsElapsed: this.state.secondsElapsed + 1});\r\n      },\r\n      componentDidMount: function() {\r\n        this.interval = setInterval(this.tick, 1000);\r\n      },\r\n      componentWillUnmount: function() {\r\n        clearInterval(this.interval);\r\n      },\r\n      render: function() {\r\n        return (\r\n          <div>Seconds Elapsed: {this.state.secondsElapsed}</div>\r\n        );\r\n      }\r\n    });\r\n\r\nIt works alright. if i change the tick function it hotreloads without a problem but when writing this in typescript:\r\n\r\n    import * as React from \"react\";\r\n\r\n    interface ITimerState {\r\n        count: number;\r\n    }\r\n\r\n    export class Timer extends React.Component<any, ITimerState>{\r\n\r\n        private _interval: any;\r\n\r\n        constructor() {\r\n            super();\r\n            this.state = {\r\n                count: 0\r\n            };\r\n            this._interval = setInterval(this.count, 1000);\r\n        }\r\n\r\n        count = () => {\r\n            this.setState({ count: this.state.count + 10 });\r\n        }\r\n\r\n        componentWillUnmount() {\r\n            clearInterval(this._interval);\r\n        }\r\n\r\n        render() {\r\n            return (\r\n                <div>Seconds Elapsed: {this.state.count}</div>\r\n            );\r\n        }\r\n    }\r\n\r\nUpdating the count function doesn't hotreload it.\r\nIf it's any help, this is what it compiles to:\r\n\r\n    var __extends = (this && this.__extends) || function (d, b) {\r\n        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\r\n        function __() { this.constructor = d; }\r\n        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n    };\r\n    var React = require(\"react\");\r\n    var Timer = (function (_super) {\r\n        __extends(Timer, _super);\r\n        function Timer() {\r\n            var _this = this;\r\n            _super.call(this);\r\n            this.count = function () {\r\n                _this.setState({ count: _this.state.count + 10 });\r\n            };\r\n            this.state = {\r\n                count: 0\r\n            };\r\n            this._interval = setInterval(this.count, 1000);\r\n        }\r\n        Timer.prototype.componentWillUnmount = function () {\r\n            clearInterval(this._interval);\r\n        };\r\n        Timer.prototype.render = function () {\r\n            return (React.createElement(\"div\", null, \"Seconds Elapsed: \", this.state.count));\r\n        };\r\n        return Timer;\r\n    })(React.Component);\r\n    exports.Timer = Timer;\r\n"},"comment":{"url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/comments/211068047","html_url":"https://github.com/gaearon/react-hot-loader/issues/209#issuecomment-211068047","issue_url":"https://api.github.com/repos/gaearon/react-hot-loader/issues/209","id":211068047,"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-04-17T17:44:57Z","updated_at":"2016-04-17T17:44:57Z","body":"Functions defined inside constructor can’t be reloaded. This is more or less by design—no easy way to get around it."}}