microsoft / microsoft/TypeScript
Add a code action to implement (overwritten) method from base class
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search Terms
implement, inherited, method
Suggestion
When implementing a method that is defined in a class's base class or in external type declarations, it would be helpful if we didn't have to type out the method signature that is already known to TypeScript.
Use Cases
Overwriting methods in inherited classes. Here's an example for implementing a custom winston transport.

TypeScript knows the method signature, but I have to type it out manually, potentially making a mistake along the way.
Examples
import * as Transport from "winston-transport";
export class SpyTransport extends Transport {
log| // cursor here!
}
VSCode should offer a code action implement method "log" from base class "Transport". After invoking it, the code should look like this:
import * as Transport from "winston-transport";
export class SpyTransport extends Transport {
public log(info: any, next: () => void): any {
throw new Error("not implemented!");
}
}
For reference, the type declarations look as follows:
declare class TransportStream extends stream.Writable {
public format?: logform.Format;
public level?: string;
public silent?: boolean;
public handleExceptions?: boolean;
constructor(opts?: TransportStream.TransportStreamOptions);
public log?(info: any, next: () => void): any;
public logv?(info: any, next: () => void): any;
public close?(): void;
}
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the TypeScript or VSCode code-action entry point that handles inherited or unimplemented methods. Use the issue's TransportStream example and declaration as the behavioral reference, and consider the work complete when a code action offers the inherited method and generates its known signature and stub.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100