Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excess property check not working with certain intersections #49520

Closed
ahejlsberg opened this issue Jun 13, 2022 · 1 comment Β· Fixed by #49503
Closed

Excess property check not working with certain intersections #49520

ahejlsberg opened this issue Jun 13, 2022 · 1 comment Β· Fixed by #49503
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@ahejlsberg
Copy link
Member

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

@ahejlsberg
Copy link
Member Author

ahejlsberg commented Jun 13, 2022

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants