Skip to content
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

Closed
wants to merge 2 commits into from
Closed

feat: add typescript Definition file #760

wants to merge 2 commits into from

Conversation

shepherdwind
Copy link
Contributor

增加 tsd 类型文件,使用例子 eggjs/examples#24

接口说明主要基于 https://eggjs.org/api/index.html 说明文件复制过来。

@mention-bot
Copy link

@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
Copy link

codecov bot commented Apr 16, 2017

Codecov Report

Merging #760 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #760   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          25     25           
  Lines         641    641           
=====================================
  Hits          641    641

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8893f7...7d86220. Read the comment docs.

package.json Outdated
@@ -46,6 +46,10 @@
"utility": "^1.11.0"
},
"devDependencies": {
"@types/accepts": "^1.3.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这不能放 dev 吧

Copy link
Contributor Author

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 - 默认语言是美式英语,毕竟支持多语言,基本都是以英语为母板
Copy link
Member

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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

话说这里例子能跑么

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能跑,就是用来写 ts 试试自动补全功能的。

Copy link
Member

@popomore popomore Apr 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看看能不能加一个 compile 的测试用例,按道理如果定义出错编译会报错的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compile 的测试我把 examples 那里的代码弄过来试下。

Copy link
Member

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 到相应的插件里?这样也好管理~

Copy link
Contributor Author

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 这个库,我一起发一下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shepherdwind
Copy link
Contributor Author

DefinitelyTyped/DefinitelyTyped#15971

@shepherdwind shepherdwind deleted the add-tsd branch April 19, 2017 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants