microsoft / microsoft/TypeScript

JS IntelliSense only picks up JSDoc @inherits rule in class definition but not on children or instances

Open
#41,256 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: JSDoc Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TS Template added by @mjbvz

TypeScript Version: 4.1.0-dev.20201026

Search Terms

  • jsdoc

  • VSCode Version: 1.50.1
  • OS Version: 18.04

Steps to Reproduce:

I apologize if this is not the correct place for this issue, I tried hard finding the repository that is responsible for js intellisense.

  1. Create a new js file
  2. Copy below code into the file
function Mixin1 (base) {
  return class extends base {
    foo() {}
  }
}

function Mixin2 (base) {
  return class extends base {
    bar() {}
  }
}

class IntermediateDummyClass extends Mixin1(Object) {}

/**
 * @implements {IntermediateDummyClass}
 */
class Composite extends Mixin2(IntermediateDummyClass) {
  
}

let c = new Composite;

c.
  1. Observe autocomplete suggestions - within Composite class both foo and bar are suggested

image

However when instantiated or extended only bar is picked up.

image

image

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

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 by running the provided JavaScript reproduction in the TypeScript language service and compare IntelliSense for Composite, its instance, and an extending class. Trace how the JSDoc @implements rule is applied in the reproduction, then verify that foo and bar are suggested consistently for the class, instances, and children.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.