microsoft / microsoft/TypeScript

Only prompt the first matching definition

Open
#45,239 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

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

  • VS Code Version: Version: 1.58.0
  • OS Version: macos catalina 10.15.7

Steps to Reproduce:

// package 'A'
export interface IConfig {}

export class Define {
  public config: IConfig
}
 
// -------------------------- //

// package 'B'
// package 'B' - a.ts
declare module 'A' {
  interface IConfig {
    setB1: () => {}
  }
}

// package 'B' - b.ts
declare module 'A' {
  interface IConfig {
    setB2: () => {}
  }
}

// -------------------------- //

// package 'C'
declare module 'A' {
  interface IConfig {
    setC: () => {}
  }
}

// -------------------------- //

// use
import { IConfig, Define } from 'A';

const a: IConfig // no problem, support `setB1` `setB2` `setC`

const b = new Define();
b.config // error, only prompt support for `setB1` method

Is there a way to make b.config prompt for all methods? In addition to using b.config as Iconfig

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

Reproduce the declaration-merging example from the issue with packages A, B, and C, then compare completion for a direct IConfig value with completion for b.config. Trace the TypeScript language-service or type-checking behavior involved and add a regression test demonstrating that all merged members are offered for b.config.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.