[microsoft/TypeScript] New behavior in v6 when interface extends two incompatible interfaces under exactOptionalPropertyTypes (Issue #62569)
DRANK

chriskrycho created an issue (microsoft/TypeScript#62569) ### 🔎 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 ```ts 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](https://github.com/true-myth/true-myth)’s nightly TS@next CI job as well as dependabot upgrades that test. The [semver-ts.org](https://semver-ts.org) guidance to test against upcoming versions is: good! -- Reply to this email directly or view it on GitHub: https://github.com/microsoft/TypeScript/issues/62569 You are receiving this because you are subscribed to this thread. Message ID: <microsoft/TypeScript/issues/62569@github.com>

github.com
Related Topics: TypeScript
1 comments