-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add typescript Definition file #760
Conversation
@shepherdwind, thanks for your PR! By analyzing the history of the files in this pull request, we identified @popomore, @fengmk2 and @dead-horse to be potential reviewers. |
Codecov Report
@@ Coverage Diff @@
## master #760 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 25 25
Lines 641 641
=====================================
Hits 641 641 Continue to review full report at Codecov.
|
package.json
Outdated
@@ -46,6 +46,10 @@ | |||
"utility": "^1.11.0" | |||
}, | |||
"devDependencies": { | |||
"@types/accepts": "^1.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这不能放 dev 吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我改下
index.d.ts
Outdated
/** | ||
* I18n options | ||
* @member Config#i18n | ||
* @property {String} defaultLocale - 默认语言是美式英语,毕竟支持多语言,基本都是以英语为母板 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
中文翻成英文吧
test/index.ts
Outdated
@@ -0,0 +1,12 @@ | |||
import { Service } from '../index'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
话说这里例子能跑么
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不能跑,就是用来写 ts 试试自动补全功能的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看看能不能加一个 compile 的测试用例,按道理如果定义出错编译会报错的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compile 的测试我把 examples 那里的代码弄过来试下。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我看 egg-mock.d.ts 都写了,要不把插件相关的声明文件都 PR 到相应的插件里?这样也好管理~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
egg-mock.d.ts 依赖了 egg.d.ts ,那个应该放 egg-mock 这个库,我一起发一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
增加 tsd 类型文件,使用例子 eggjs/examples#24 。
接口说明主要基于 https://eggjs.org/api/index.html 说明文件复制过来。