๐ 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
https://www.typescriptlang.org/play/?exactOptionalPropertyTypes=true&ts=6.0.0-dev.20251008#code/HYQwtgpgzgDiDGEAEALALmmSDeBYAUEkhAB4wD2ATmkgJbBoSUBmCyAKvDAMrnwDWENAGFywYBHhoA8jDRQcBIkQrUAXEmABXMACMmAbiVIAvgWOlVNeoxZskAQQDmEBrLS0xC0o2AATBQAFEGpaEAAbAB5OHj5BETEJKXcoAD5FQmVBCBgHcNoANwgAfg1dcnJwiBBgJAAfJC1-CGZ6CD8jTLN8boJQSFh7NHCFPEzLKmsGJlZEJFFxSQ8xd09gUeMVSdLNHX1Kesbm1okO427e-BsZ+2dXGTk17xJfANQMGAA6O7dHrwAaJDDKCfBZJZbAVZeDJEMAgEjCBAodrcaBQJ47bR6JiHJp+FptM49AhAA
๐ป 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
๐ Search Terms
Partial, @types/node, exactOptionalPropertyTypes, interface
๐ Version & Regression Information
โฏ Playground Link
https://www.typescriptlang.org/play/?exactOptionalPropertyTypes=true&ts=6.0.0-dev.20251008#code/HYQwtgpgzgDiDGEAEALALmmSDeBYAUEkhAB4wD2ATmkgJbBoSUBmCyAKvDAMrnwDWENAGFywYBHhoA8jDRQcBIkQrUAXEmABXMACMmAbiVIAvgWOlVNeoxZskAQQDmEBrLS0xC0o2AATBQAFEGpaEAAbAB5OHj5BETEJKXcoAD5FQmVBCBgHcNoANwgAfg1dcnJwiBBgJAAfJC1-CGZ6CD8jTLN8boJQSFh7NHCFPEzLKmsGJlZEJFFxSQ8xd09gUeMVSdLNHX1Kesbm1okO427e-BsZ+2dXGTk17xJfANQMGAA6O7dHrwAaJDDKCfBZJZbAVZeDJEMAgEjCBAodrcaBQJ47bR6JiHJp+FptM49AhAA
๐ป Code
๐ 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/nodeneeds an update. I wanted to flag this in case/for when other folks hit it!Additional information about the issue
@types/node.