Repository: TypeScript
Issue: Completion does not work for generic type extending tuple or array of all partial type
Labels: Bug,Help Wanted,Effort: Difficult,Domain: Completion Lists

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

auto completion, suggestion, tuple, array, mapped types

<!--
  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.
-->

### 🕗 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

### ⏯ 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.
-->
[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.7.0-dev.20220215#code/PTAEEkBdQEwewKYGcB2ByaB3OAnA1gFAGQCeADgqAEICGSCAKgBYIC2lAvKAN4GigBjOKzJwUCFJAD8ALlBJIOAJYoA5gQC+RGAgEAbGjkoAzAK4oBkJWNAIAHpAkxmbBAB4+oAKIOJSayhItr4oMEEA2rT0LuygAGSgAEq6uDBuCspqADSg5ngocJgoAHwAugTFABT2joEBSHI+tf5iSACUcgBucEowRDVOMQiV4bz8wABUoADCNOjQNKaQcEIiegiOoCxGoBPAmqVtREQgoHpKCqA0ekhwsIioGKDY+ESkFNR0jCzsAEygXDGgmEonEklk8kUKnUWgIOn0hhM5ksAWCtWcPwQvw8-CafnqaKcQUqUW+rn+CWSQhwaQy0JyeQKRWKbXC5SqAzqrUaIRagQ6oG6vX6IQx5JGQMmMzmT0Wy1WZHWm22lD2ByOx1OmCUkCYoCMAEdTEojDBQMYlAg9GaXngkG9yJRSUMAMwAnieBViCTSOR0tSeQ3G00AMUt1r9UIDsPhBh2ZgsVhsnLF7BdOO8vIJKYizsxbspKRp6SjqgZKHyhRK7OqWe5mea9QFQr6BBTrolnilsxQVyWKxBSsoKt2+w0h2OBFOACMls8dXqgyaEGaLVazXMzQqh-qEEbl6vw2b4Mh5s9cIRiI7PtFMQAWd1Ar1g32QzLqfhL0NHyPvzTaXQ4yRRNUXbe8MzxLlAkJUJcy+IYH0LalaVLctK2ZGtOT5BoG3xVoBUg7CRXRBDO0-PdgxXMN1zkNBjDgOA0CyLsph7WV+23DZhwQHY1XHDVTmuW4bzJWJtV1UAClAVgaDICgzXeZB7lPJ5bVAZY4AAhF42RJNezA1w7wAdQXAA5OAAFlZPkiC62gnNQEieD70wuycMIpseUbVpiMGe8TN1cyrLklcyN3fdvxo0A6IYpiWOlM85QHNYuK2HjVTHCdNTAKSU3U0xFUoW17SvD481cABWR9PRBb1wV-aF-zhQDEXNXTQNFIYKts7z7NFIJyvYCqKlrXqcPCDzWkOLy8MCXzQi6sLuzmPt5UHVKRz4icgA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
// It doesn't work

type BaseTheme = {
  component?: string
}

declare function extendTheme<
  Extensions extends [BaseTheme & Record<string, unknown>]
>(extensions: Extensions): void

extendTheme([{
  /* Can't autocomplete here */
}])



// list also doesn't work

type BaseTheme2 = {
  component?: string
}

declare function extendTheme2<
  Extensions extends (BaseTheme2 & Record<string, unknown>)[]
>(extensions: Extensions): void

extendTheme2([{
  /* Can't autocomplete here */
}])



// with required field works

type BaseTheme3 = {
  component?: string
  requiredField: string
}

declare function extendTheme3<
  Extensions extends [BaseTheme3 & Record<string, unknown>]
>(extensions: Extensions): void

extendTheme3([{
  /* Can autocomplete here */
}])



// but with required field and complete required field doesn't work

type BaseTheme4 = {
  component?: string
  requiredField: string
}

declare function extendTheme4<
  Extensions extends [BaseTheme4 & Record<string, unknown>]
>(extensions: Extensions): Extensions

extendTheme4([{
  requiredField: 'foo',
  /* Can't autocomplete here */
}])

// also BaseTheme with no mapped types doesn't work too

declare function extendTheme4WithNoMapped<
  Extensions extends [BaseTheme4]
>(extensions: Extensions): Extensions

extendTheme4WithNoMapped([{
  requiredField: 'foo',
  /* Can't autocomplete here */
}])



// no extend tuple works

type BaseTheme5 = {
  component?: string
}

declare function extendTheme5<
  Extensions extends BaseTheme5
>(extensions: [Extensions]): Extensions

extendTheme5([{
  /* Can autocomplete here */
}])


```

### 🙁 Actual behavior

<!-- What happened, and why it was wrong -->
No autocomplete

### 🙂 Expected behavior

<!-- What you expected to happen instead, and why -->
Autocomplete