{"action":"created","issue":{"url":"https://api.github.com/repos/eggjs/egg/issues/2536","repository_url":"https://api.github.com/repos/eggjs/egg","labels_url":"https://api.github.com/repos/eggjs/egg/issues/2536/labels{/name}","comments_url":"https://api.github.com/repos/eggjs/egg/issues/2536/comments","events_url":"https://api.github.com/repos/eggjs/egg/issues/2536/events","html_url":"https://github.com/eggjs/egg/issues/2536","id":321873992,"number":2536,"title":"有没有 typescript 写 framework 的相关例子？","user":{"login":"seekcx","id":8244814,"avatar_url":"https://avatars3.githubusercontent.com/u/8244814?v=4","gravatar_id":"","url":"https://api.github.com/users/seekcx","html_url":"https://github.com/seekcx","followers_url":"https://api.github.com/users/seekcx/followers","following_url":"https://api.github.com/users/seekcx/following{/other_user}","gists_url":"https://api.github.com/users/seekcx/gists{/gist_id}","starred_url":"https://api.github.com/users/seekcx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seekcx/subscriptions","organizations_url":"https://api.github.com/users/seekcx/orgs","repos_url":"https://api.github.com/users/seekcx/repos","events_url":"https://api.github.com/users/seekcx/events{/privacy}","received_events_url":"https://api.github.com/users/seekcx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-10T09:51:50Z","updated_at":"2018-05-10T10:11:39Z","closed_at":"2018-05-10T10:11:39Z","author_association":"NONE","body":"最初想直接用 ts 来写框架，没有找到模板，也不太清楚怎么配置类似于 `dev` 的 watch。\r\n所以放弃了，暂时打算用js来写 framework。但是业务层是使用ts写的。\r\n\r\n业务层添加了框架之后，`egg-ts-helper` 能够识别框架：\r\n\r\n```js\r\n// typings/app/service/index.d.ts\r\n\r\ndeclare module 'framework' {\r\n  interface IService {\r\n  }\r\n}\r\n```\r\n\r\n所以 service 的声明变成了这样。\r\n\r\n所有 service 都报错了，\r\n![image](https://user-images.githubusercontent.com/8244814/39863841-636c52e8-547a-11e8-84a0-caf729baf379.png)\r\n\r\n\r\n更改 service 文件\r\n\r\n```js\r\nimport { Service } from 'framework';\r\n```\r\n\r\nservice 里的引用也随即报错：\r\n![image](https://user-images.githubusercontent.com/8244814/39863929-b034fe4a-547a-11e8-801d-378a645f3117.png)\r\n\r\n不知道有没有类似例子可以借鉴一下\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eggjs/egg/issues/comments/388012596","html_url":"https://github.com/eggjs/egg/issues/2536#issuecomment-388012596","issue_url":"https://api.github.com/repos/eggjs/egg/issues/2536","id":388012596,"user":{"login":"whxaxes","id":5856440,"avatar_url":"https://avatars0.githubusercontent.com/u/5856440?v=4","gravatar_id":"","url":"https://api.github.com/users/whxaxes","html_url":"https://github.com/whxaxes","followers_url":"https://api.github.com/users/whxaxes/followers","following_url":"https://api.github.com/users/whxaxes/following{/other_user}","gists_url":"https://api.github.com/users/whxaxes/gists{/gist_id}","starred_url":"https://api.github.com/users/whxaxes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whxaxes/subscriptions","organizations_url":"https://api.github.com/users/whxaxes/orgs","repos_url":"https://api.github.com/users/whxaxes/repos","events_url":"https://api.github.com/users/whxaxes/events{/privacy}","received_events_url":"https://api.github.com/users/whxaxes/received_events","type":"User","site_admin":false},"created_at":"2018-05-10T10:11:39Z","updated_at":"2018-05-10T10:11:39Z","author_association":"MEMBER","body":"https://github.com/eggjs/examples/tree/master/hackernews-async-ts"}}
{"actor":{"display_login":"whxaxes"}}