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

Add typescript support #8

Merged
merged 2 commits into from May 28, 2019
Merged

Add typescript support #8

merged 2 commits into from May 28, 2019

Conversation

JacksonTian
Copy link
Owner

No description provided.

@coveralls
Copy link

coveralls commented May 28, 2019

Coverage Status

Coverage increased (+0.4%) to 83.088% when pulling 298bc53 on d.ts into 9f4b0dc on master.

@@ -159,27 +162,28 @@ exports.read = function (response, encoding) {
}

return new Promise((resolve, reject) => {
const makeReadTimeoutError = (err) => {
const makeReadTimeoutError = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

这样改的话,就不知道 err 对象是具体哪个阶段生成的了

Copy link
Owner Author

Choose a reason for hiding this comment

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

有堆栈的吧

Copy link
Contributor

Choose a reason for hiding this comment

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

堆栈永远在 makeReadTimeoutError 这个函数里,之前分散到各个调用 makeReadTimeoutError 的地方是为了看到 error 是由哪里产生的吧

Copy link
Owner Author

Choose a reason for hiding this comment

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

这个地方不是异步操作 栈应该ok 的。

lib/index.d.ts Outdated
'data'?: string|Buffer|undefined;
}

export function request<T>(url: string, options: Options): Promise<IncomingMessage>;
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的泛型 <T> 好像没有作用?

Copy link
Contributor

@hyj1991 hyj1991 left a comment

Choose a reason for hiding this comment

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

+1

@JacksonTian
Copy link
Owner Author

更新了

@JacksonTian JacksonTian merged commit 23b40f3 into master May 28, 2019
@JacksonTian JacksonTian deleted the d.ts branch November 27, 2023 09:54
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

3 participants