-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
π Search Terms
Partial, @types/node, exactOptionalPropertyTypes, interface
π Version & Regression Information
- This changed between versions v5.9.3 and 6.0.0-dev.20251001
β― Playground Link
π» Code
namespace http {
export interface TcpSocketConnectOpts {
port: number;
}
export interface AgentOptions extends Partial<TcpSocketConnectOpts> {
keepAlive?: boolean | undefined;
}
}
namespace tls {
export interface ConnectionOptions {
port?: number | undefined;
}
}
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
maxCachedSessions?: number | undefined;
}
π Actual behavior
This now fails to type checkβI believe correctly, because Partial<{ port: number }>
is { port?: number }
, not { port?: number | undefined }
. Itβs surprising that this worked before.
π Expected behavior
Actually, the new behavior is expected, so probably @types/node
needs an update. I wanted to flag this in case/for when other folks hit it!
Additional information about the issue
- Happens on latest
@types/node
. - Discovered via True Mythβs nightly TS@next CI job as well as dependabot upgrades that test. The semver-ts.org guidance to test against upcoming versions is: good!
Renegade334 and RyanCavanaugh
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug