-
-
Notifications
You must be signed in to change notification settings - Fork 676
Closed
Labels
TypesChanges related to the TypeScript definitionsChanges related to the TypeScript definitionsbugSomething isn't workingSomething isn't working
Description
Hi, thought of submitting a couple type fixes for the *.d.types to improve some VSCode IntelliSense.
For example, Client.Options.socketPath type is missing when the following lines use it:
Line 103 in d04ec2b
| socketPath, |
undici/benchmarks/benchmark.js
Line 27 in d04ec2b
| dest.socketPath = path.join(os.tmpdir(), 'undici.sock') |
A question before I proceed, am I correct that the types below:
Lines 20 to 52 in d04ec2b
| declare namespace Client { | |
| export interface Options { | |
| /** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */ | |
| keepAliveTimeout?: number | null; | |
| /** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */ | |
| keepAliveMaxTimeout?: number | null; | |
| /** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */ | |
| keepAliveTimeoutThreshold?: number | null; | |
| /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */ | |
| pipelining?: number | null; | |
| /** **/ | |
| connect?: buildConnector.BuildOptions | buildConnector.connector | null; | |
| /** The maximum length of request headers in bytes. Default: `16384` (16KiB). */ | |
| maxHeaderSize?: number | null; | |
| /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */ | |
| bodyTimeout?: number | null; | |
| /** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */ | |
| headersTimeout?: number | null; | |
| /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */ | |
| strictContentLength?: boolean; | |
| /** @deprecated use the connect option instead */ | |
| tls?: TlsOptions | null; | |
| /** */ | |
| maxRequestsPerClient?: number; | |
| /** Max response body size in bytes, -1 is disabled */ | |
| maxResponseSize?: number | null; | |
| /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */ | |
| autoSelectFamily?: boolean; | |
| /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */ | |
| autoSelectFamilyAttemptTimeout?: number; | |
| interceptors?: {Client: readonly DispatchInterceptor[] | undefined} | |
| } |
..are intended for the constructor below?
Lines 88 to 115 in d04ec2b
| class Client extends DispatcherBase { | |
| constructor (url, { | |
| interceptors, | |
| maxHeaderSize, | |
| headersTimeout, | |
| socketTimeout, | |
| requestTimeout, | |
| connectTimeout, | |
| bodyTimeout, | |
| idleTimeout, | |
| keepAlive, | |
| keepAliveTimeout, | |
| maxKeepAliveTimeout, | |
| keepAliveMaxTimeout, | |
| keepAliveTimeoutThreshold, | |
| socketPath, | |
| pipelining, | |
| tls, | |
| strictContentLength, | |
| maxCachedSessions, | |
| maxRedirections, | |
| connect, | |
| maxRequestsPerClient, | |
| localAddress, | |
| maxResponseSize, | |
| autoSelectFamily, | |
| autoSelectFamilyAttemptTimeout | |
| } = {}) { |
I'm thinking of adding types for options.socketPath, but also noticed missing types for other parameters like options.socketTimeout, is it alright to include those?
Thanks.
Metadata
Metadata
Assignees
Labels
TypesChanges related to the TypeScript definitionsChanges related to the TypeScript definitionsbugSomething isn't workingSomething isn't working