在NodeJS上使用TypeScript并使用npm request-promise(包装npm请求)。
我想使用“time”选项来计算往返时间here“时间 - 如果为true,请求 - 响应周期(包括所有重定向)的时间分辨率为毫秒,结果在响应的elapsedTime属性上提供“并且在npm中可用作为证明here
if (options.time) {
self.timing = true
self.elapsedTime = self.elapsedTime || 0
}
但我可以找到的任何请求定义似乎都不支持此选项。
所以我的第一个问题是 - 我读错了吗?
如果没有,我的第二个问题是 - 有没有理由不存在?
最后,如果它应该在那里 - 我可以修改我的定义的本地副本,但是,当然,更好的方法是修复存储库定义,我只是不确定最好的方法去做那么谁能指出我正确的方向呢?
答案 0 :(得分:2)
请求包的输入法定义中缺少时间选项的定义:https://github.com/louy/typed-request/blob/master/index.d.ts
标签定义适用于请求包(https://github.com/typings/registry/blob/master/npm/request.json)的2.69版本,该版本可能没有该时间选项
要修复存储库定义,您可以要求类型请求存储库的作者修复它,或者您可以分叉主存储库,执行更新并向原始作者发出拉取请求。 与此同时,您仍然可以使用以下命令将更新后的定义安装到项目中:
1>------ Build started: Project: HttpServer, Configuration: Release Win32 ------
1> main.cpp
1>libzmq.lib(zmq.obj) : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
1>libzmq.lib(socket_poller.obj) : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol ___WSAFDIsSet@8
1>libzmq.lib(zmq.obj) : error LNK2001: unresolved external symbol __imp__select@20
1>libzmq.lib(socket_poller.obj) : error LNK2001: unresolved external symbol __imp__select@20
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__select@20
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__select@20
1>libzmq.lib(zmq.obj) : error LNK2001: unresolved external symbol __imp__WSAStartup@8
1>libzmq.lib(zmq.obj) : error LNK2001: unresolved external symbol __imp__WSACleanup@0
1>libzmq.lib(socks_connecter.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(tcp.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(tcp_connecter.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(zmq.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(err.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(socket_poller.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__htonl@4
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__htonl@4
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libzmq.lib(udp_address.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libzmq.lib(stream_engine.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>libzmq.lib(stream_engine.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol _if_nametoindex@4
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__getaddrinfo@16
1>libzmq.lib(socks.obj) : error LNK2001: unresolved external symbol __imp__getaddrinfo@16
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__freeaddrinfo@4
1>libzmq.lib(socks.obj) : error LNK2001: unresolved external symbol __imp__freeaddrinfo@4
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol __imp__getnameinfo@28
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__getnameinfo@28
1>libzmq.lib(tcp_address.obj) : error LNK2001: unresolved external symbol _in6addr_any
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__getsockname@12
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__getsockname@12
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__getsockname@12
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__getsockopt@20
1>libzmq.lib(tcp_connecter.obj) : error LNK2001: unresolved external symbol __imp__getsockopt@20
1>libzmq.lib(socks_connecter.obj) : error LNK2001: unresolved external symbol __imp__getsockopt@20
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSACloseEvent@4
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSACreateEvent@0
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSAEventSelect@12
1>libzmq.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSAWaitForMultipleEvents@20
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__accept@12
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__accept@12
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libzmq.lib(tcp_connecter.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libzmq.lib(socks_connecter.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>libzmq.lib(socks_connecter.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(stream_engine.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(tcp_connecter.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__connect@12
1>libzmq.lib(tcp_connecter.obj) : error LNK2001: unresolved external symbol __imp__connect@12
1>libzmq.lib(socks_connecter.obj) : error LNK2001: unresolved external symbol __imp__connect@12
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__listen@8
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__listen@8
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__recv@16
1>libzmq.lib(tcp.obj) : error LNK2001: unresolved external symbol __imp__recv@16
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__send@16
1>libzmq.lib(tcp.obj) : error LNK2001: unresolved external symbol __imp__send@16
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>libzmq.lib(signaler.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>libzmq.lib(tcp_listener.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>libzmq.lib(tcp.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>libzmq.lib(udp_address.obj) : error LNK2001: unresolved external symbol __imp__inet_addr@4
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__inet_addr@4
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__ioctlsocket@12
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__getpeername@12
1>libzmq.lib(ip.obj) : error LNK2001: unresolved external symbol __imp__socket@12
1>libzmq.lib(tcp.obj) : error LNK2001: unresolved external symbol __imp__WSAIoctl@36
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__inet_ntoa@4
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__recvfrom@24
1>libzmq.lib(udp_engine.obj) : error LNK2001: unresolved external symbol __imp__sendto@24
1>H:\Programming\c++\HttpServer\Release\HttpServer.exe : fatal error LNK1120: 35 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========