microsoft / microsoft/TypeScript

Missing IntelliSense for optional property from array type constraints

Open
#43,917 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Completion Lists Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Bug Report

🔎 Search Terms
🕗 Version & Regression Information

searched a related issue: https://github.com/microsoft/TypeScript/issues/30058

⏯ Playground Link

Playground link with relevant code

💻 Code
type ZZZ = {
    bar?: number,
    foo: string
}

function test<T extends ZZZ>(c: T) {

}

function testArr<T extends ZZZ[]>(c: T) {

}

// case 1:
test({
    // foo got intellisense
    // bar got intellisense
})

// case 2:
test({
    foo: '333',
    // bar got intellisense
})

// case 3:
testArr([
    {
        foo: '111',
        // bar got no intellisense
    },
])

// case 4:
testArr([
    {
        // foo got intellisense
        // bar got intellisense
    }
]);
🙁 Actual behavior

case 3 missing the IntelliSense for option property bar

🙂 Expected behavior

show completion for property bar

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked TypeScript Playground and compare IntelliSense in test and testArr, focusing on case 3 where the array element lacks completion for bar. Done means the optional property bar is offered there while preserving the existing completion behavior in the other cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.