Repository: TypeScript
Issue: Object key completions on overloaded generic function incorrectly shows keys for primitive types
Labels: Bug,Help Wanted,Domain: Completion Lists

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

Refactored function parameter hints with generics are incorrect

### 🕗 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 about [Functions](https://github.com/Microsoft/TypeScript/wiki/FAQ#functions) and [Generics](https://github.com/Microsoft/TypeScript/wiki/FAQ#generics) .

### ⏯ Playground Link

<!--
  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.
-->
No generics normal: [Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.3&ssl=16&ssc=1&pln=1&pc=1#code/C4TwDgpgBA4hwCUIGcoF4oG8BQUoBMBDYQgLikIDsRsBfbbAMwFdKBjYASwHtKoBzeAAo2vRp37lkwAE6dK-AJTk4iFE1YcefQcBFiJ5TFGYyANlNnz+UWstjwkyDey68Bw0ZXGSo0uQpQAD5YJuaWATZ2Ko4oWLhQXtJhZuhQoJDcjIkGNmj5UADk-taFUAD8Od4SUORePgB0pmYJScAExIRpAIy93Qx4MvCmfMZEJLZ0DAD001AActwelBBybKiU3DIAtoQtukKK2EA)

There are generics, the object wording prompt is incorrect: [Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.3#code/C4TwDgpgBA4hwCUIGcA8AVAfFAvFA3gFBRQAmAhsOQFxTqEC+hhAZgK4B2AxsAJYD2HKAHN4GXFHIcQmABRdBLXsNrJgAJ14dhASlpxEKDJlaceAoaODi8UmfMXLa+KG3UAbVRq3CoDPbDwSGhYptx8giJi6BJ2cgocSipQapraUAA+BK4eXmm+-vpBRlgExFAJajnuEqCQ-CwVjr44rVAA5Kk+7VAA-E2JylC0CUkAdG7u5ZXAZJTkEgCMy4vMJOrwbkIuFFR+ksiBhiEmTIQA9Od0ABbQ-ABGAFYQPFAA7vzqpD5QYOr8AFswLNeIctAp1BseIQrLIdIQgA)

There are generics, swapping the overloaded function position shows normal: [Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.3#code/C4TwDgpgBA4hwCUIGcA8AVAfFAvFA3gFBRQAmAhsOQFxTqEC+hhAZgK4B2AxsAJYD2HKAHN4GXFHIcQmABRdBLXsNr4obAE4AbWsmAbeHYVAYBKWnEQoMmVpx4Cho4OLxSZ8xct37Dw87DwSGhYdtx8giJi6BLucgocSipQegZGUAA+BOraPmnGZhZB1lgExFAJejlaEqCQ-CwVXsY4rVAA5Kl+7VAA-E2JylC0CUkAdJpa5ZXAZJTkEgCMy4vMJBrwmkJqFFQmksiBViG2TIQA9OdQAMoA7uRgYH5QwAAW0PwAbhDa-OSkEFIUHY4UcUDA-GQvAiQmQr34t0OHH4GgAtuQps5ZKZCEA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
// We can quickly address your report if:
//  - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
//  - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
//  - The incorrectness of the behavior is readily apparent from reading the sample.
// Reports are slower to investigate if:
//  - We have to pare too much extraneous code.
//  - We have to clone a large repo and validate that the problem isn't elsewhere.
//  - The sample is confusing or doesn't clearly demonstrate what's wrong.

type GetRes<T> = {
  data: T
}

function get<T = any>(config: string): GetRes<T>
function get<T = any>(config: { url: string }): GetRes<T>
function get<T = any>(config: string | { url: string }): GetRes<T> {
  const url = typeof config === 'string' ? config : config.url
  const data = 1111

  return { data } as GetRes<T>
}

// The object wording prompt is incorrect
get()
```

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->

I also don't know why the position of the string parameter refactoring function affects the type hint of the object parameter refactoring function.

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->

Does not affect type hints.