Skip to content

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

Description

  • VSCode Version: 1.41.0
  • OS Version: macOS 10.14.6

Steps to Reproduce:

>> Playground Link

interfaceCustomElements{'component-one': {foo?: string;},'component-two': {bar?: string;}}interfaceOptions<TextendskeyofCustomElements>{props: CustomElements[T];}functioncreate<TextendskeyofCustomElements>(name: T,options: Options<T>){return{ name, options };}create('component-one',{props: {/* trigger intellisense here */}});constopts: 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

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions