Skip to content

Excess property check not working with certain intersectionsΒ #49520

Closed
@ahejlsberg

Description

@ahejlsberg

πŸ•— 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.

Metadata

Metadata

Assignees

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