microsoft / microsoft/TypeScript

Completion does not work for generic type extending tuple or array of all partial type

Open
#63,785 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

### Extension Version

0.20251202.1

### VS Code Version

1.103.2

### Operating system Version

Linux Mint 22.2 Zara

### Steps to reproduce

1. Paste the following code into VS Code.
2. In each example, type com... and check whether it is auto-completed.

### Issue

```ts
// All partial type works

type AllPartialObject = {
component?: string
}

declare function extendTheme1(
extensions: Extensions
): void

extendTheme1([
{
/* Can autocomplete `component` here */
},
])

// But all partial type with mapped types doesn't work

declare function extendTheme2<
Extensions extends [AllPartialObject & Record],
>(extensions: Extensions): void

extendTheme2([
{
/* Can't autocomplete `component` here */
},
])

// with required field works

type PartialWithRequiredObject = {
component?: string
requiredField: string
}

declare function extendTheme3<
Extensions extends [PartialWithRequiredObject & Record],
>(extensions: Extensions): void

extendTheme3([
{
/* Can autocomplete `component` here */
},
])

// but with required field and complete required field doesn't work

extendTheme3([
{
requiredField: 'foo',
/* Can't autocomplete `component` here */
},
])

// also BaseTheme with no mapped types doesn't work too

declare function extendTheme4(
extensions: Extensions
): Extensions

extendTheme4([
{
requiredField: 'foo',
/* Can't autocomplete `component` here */
},
])

// no extend tuple works

declare function extendTheme5<
Extensions extends AllPartialObject & Record,
>(extensions: [Extensions]): Extensions

extendTheme5([
{
/* Can autocomplete `component` here */
},
])
```

Original issue: https://github.com/microsoft/TypeScript/issues/45617

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the completion differences among extendTheme1 through extendTheme5 in VS Code using the TypeScript examples in the issue, then compare the behavior with the linked original issue. Done means component completion appears in the currently failing generic tuple and mapped-type cases without regressing the working examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
compilers, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.