Repository: TypeScript
Issue: Argument of type X is not assignable to parameter of type Y, but then assignable. - Misleading error
Labels: Suggestion,Help Wanted,Experience Enhancement,Cursed?

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

 Argument of type is not assignable to parameter of type, object properties overlap

### 🕗 Version & Regression Information

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries.

The closest I could find in the FAQ is this https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-all-types-assignable-to-empty-interfaces

Type `{ color: "red", margin: 1 }` has the required member of `Props`, so it may correctly be evaluated by TS as fitting, however, the error in the first place is then misleading.

### ⏯ Playground Link

_same result with 4.8.0-beta_

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.7.4#code/KYDwDg9gTgLgBAYwgOwM7wJargXjgHgBUBDKAc2BkIE8xgAaAPgAoBKXRgwuUGYZACbYS5SjTotSZAFxxCrWdxycpAKFUxawOAAUoEMNjwBvRBAA20WeigZkZOAF915ynBC44WfHoOoWrMymALZSdrIAjE7sAPQxcACiAEpJAPJJsgCC5ACuwfzwEABmcJp0cADkIWHIssh5AEbAUADcThVe2MgQ8MSoqBhkyMQNrqUQcGCkxPl8UHDFpVqVvoYVAHRwqQ0AVsAI8OYYc8TmcKHUC8jml6h0CBhFlwDW3QDuyJP6dLAYwKj0ODEQSVULkOwdAQQf5wbrwUBYTCfMraCqrVAbZgAJgAzAAWACsrFUrnglzw3nRASCZksUFkACIoMABAzAWCyOE4FFHLF4hy7HB1sLNqkANJAA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
export const is = <TargetType,>() => <T extends TargetType>(arg: T): T => arg

type Props = { color: string }

let x = is<Props>()({ margin: 1 }) // ERROR: Argument of type '{ margin: number; }' is not assignable to parameter of type 'Props'. Object literal may only specify known properties, and 'margin' does not exist in type 'Props'.(2345)
let y = is<Props>()({ color: "red", margin: 1 }) // margin .... OK
```


Since `{margin: 1}` is clearly tolerated, the error given is misleading as the actual error is not in the presence of `margin` but in the absence of `color`, which is a property required by the `Props` type.

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->

Argument of type '{ margin: number; }' is not assignable to parameter of type 'Props'. **_Object literal may only specify known properties, and 'margin' does not exist in type 'Props'._**(2345)

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->

Argument of type '{ margin: number; }' is not assignable to parameter of type 'Props'. **_Object literal does not specify properties required by 'Props'._**(2345)