Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Properties in object literal key completion list aren't filtered when a prior argument supplies a mapped type key #35702

Copy link
Copy link
@simonhaenisch

Description

@simonhaenisch
Issue body actions
  • VSCode Version: 1.41.0
  • OS Version: macOS 10.14.6

Steps to Reproduce:

>> Playground Link

interface CustomElements {
    'component-one': {
        foo?: string;
    },
    'component-two': {
        bar?: string;
    }
}

interface Options<T extends keyof CustomElements> {
    props: CustomElements[T];
}

function create<T extends keyof CustomElements>(name: T, options: Options<T>) {
    return { name, options };
}

create('component-one', { props: { /* trigger intellisense here */ } });

const opts: Options<'component-one'> = {
    props: { /* and here */ }
}

The type of props in the create call is correctly narrowed down to CustomElements['component-one'] by the type system, however Intellisense suggests the props of all fields of CustomElements:

This does not happen when creating an object of that type:

Does this issue occur when all extensions are disabled?: Yes

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editor

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.