Skip to content

Generic object literal completions include any random member you’re currently typing #35268

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#85185

TypeScript Version: 3.8.0-dev.20191121

Search Terms:

  • suggest / suggestions / completions / intellisense
  • optional
  • extends

Code
For the code:

interface Test {
    keyPath?: string;
    autoIncrement?: boolean;
}

function test<T extends Record<string, Test>>(opt: T) { }

test({
    a: {
        keyPath: '',
        a
    }
})

Trigger suggestions after a in the call to test.

Expected behavior:
Suggestion for autoIncrement returned.

Actual behavior:
No suggestion for autoIncrement. Only a single suggestion for a is returned

[Trace  - 18:58:01.966] <semantic> Sending request: completionEntryDetails (90). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/a.ts",
    "line": 11,
    "offset": 10,
    "entryNames": [
        "a"
    ]
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions