microsoft / microsoft/TypeScript

No auto-completion on typescript interface with classes implement

Open
#31,956 14 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Redirected by https://github.com/microsoft/vscode-cpptools/issues/3789

Type: LanguageService
Describe the bug

  • macOS Mojave 10.14.5
  • VSCODE : 1.35.1
  • TS 3.5.1

To Reproduce

Create a file with the following :

import { Strategy } from "passport-local";

class SSOPlugin implements Plugin {

  constructor() {}

  init() {}
}

interface Plugin {
  authenticators?: Record<string, any>;

  strategies: { [key: string]: KuzzleStrategy };
}

interface KuzzleStrategy {
  config: {
    authenticator: string;
    fields: string[];
  };
  methods: {
    afterRegister?: () => any;
    create: () => any;
    delete: () => any;
    exists: () => any;
    getById?: () => any;
    getInfo?: () => any;
    update: () => any;
    validate: () => any;
    verify: () => any;
  };
}

export = SSOPlugin;

In constructor or any method using this. and auto-completion doesn't give anything.

But if I give the wrong types, the compiler complain (also red line on IDE).

Expected behavior

I should get auto-completion.

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 reproducing the reported TypeScript language-service behavior with the interface and implementing class shown in the issue, then compare completions inside the constructor and methods with the compiler's type errors. Trace the completion entry point for this in an implementing class and add a regression test covering the interface members. Done means the expected members appear in auto-completion without changing type checking.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, devtools
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.