้•œๅƒ็ซ™็‚น ยท ๆœฌ้กต็”ฑ็ฌฌไธ‰ๆ–น GitHub ๅช่ฏป้•œๅƒๆไพ›๏ผŒ้ž GitHub ๅฎ˜ๆ–น็ซ™็‚น๏ผŒไธๆŽฅๅ—ไปปไฝ•็™ปๅฝ•ๆˆ–ๅ‡ญๆฎ่พ“ๅ…ฅใ€‚ๅ‰ๅพ€ github.com
Skip to content

New behavior in v6 when interface extends two incompatible interfaces under exactOptionalPropertyTypesย #62569

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

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

Activity

  1. Andarist commented on Oct 9, 2025

    @Andarist
    Contributor

    bisects to #61683

  2. jakebailey commented on Oct 9, 2025

    @jakebailey
    Member

    Probably this means we need to add yet another tsconfig variant to the node types to test this. But perhaps we should simply revert that PR...

  3. Renegade334 commented on Oct 9, 2025

    @Renegade334
    Contributor

    I think we're better off just testing with exactOptionalPropertyTypes ubiquitously. We intend to be compatible with it, so is there any added value in testing without it as well?

  4. jakebailey commented on Oct 9, 2025

    @jakebailey
    Member

    Probably not... (When it's not 4am for me I intend to hack dtslint to force this option on and see how bad things are in DT)

  5. RyanCavanaugh commented on Oct 9, 2025

    @RyanCavanaugh
    Member

    Thanks for the report on this!

  6. jakebailey commented on Oct 9, 2025

    @jakebailey
    Member

    Based on the label, we agree this is a bug in the types, yes? So DT has to be fixed?

  7. RyanCavanaugh commented on Oct 9, 2025

    @RyanCavanaugh
    Member

    Yep

  8. chriskrycho commented on Oct 10, 2025

    @chriskrycho
    Author

    Confirmed resolved with @types/node@24.7.1. Closing this accordingly. Thanks for hopping on it in the types so quickly Jake Bailey (@jakebailey) and for writing a test for it Mateusz Burzyล„ski (@Andarist)! Appreciate you folks.

  9. locked as resolved and limited conversation to collaborators on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions