Skip to content

Excess property check not working with certain intersectionsΒ #49520

Closed

Description

πŸ•— Version & Regression Information

This is the behavior in every version I tried.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

let x1: { data: { a: string } } = { data: { a: "hello", b: true }};  // Excess property error
let x2: { data: { a: string } } & { x?: string } = { data: { a: "hello", b: true }};  // Excess property error
let x3: { [key: string]: { a: string } } = { data: { a: "hello", b: true }};  // Excess property error
let x4: { [key: string]: { a: string } } & { x?: string } = { data: { a: "hello", b: true }};  // No error!

πŸ™ Actual behavior

No excess property error on the last line of example.

πŸ™‚ Expected behavior

Excess property errors on all lines of example.

Activity

  1. ahejlsberg commented on Jun 13, 2022

    @ahejlsberg
    MemberAuthor

    This issue was uncovered by #49503. With #49503 there is now an excess property error issued in one of the tests of the waterline Definitely Typed package. That error should have been there all along (and the test even seems to indicate so in a comment).

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

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions