Skip to content

Parameter hints while overriding methodsΒ #42668

Open
@JacksonKearl

Description

@JacksonKearl

Suggestion

It would be nice to get parameter hints while overriding methods or implementing abstract methods.

πŸ” Search Terms

  • parameter hints
  • overriding methods
  • abstract parameters

βœ… Viability 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, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

When implementing an abstract class or overriding an existing class's methods, it would be great to be able to see the parameter hints for that method in the editor.

πŸ“ƒ Motivating Example

abstract class A {
  abstract foo(param1: string, param2: number, param3: boolean): void;
}

class B extends A {
  foo(/*trigger parameter hints here, see nothing*/)
}

type AA = {
  foo(param1: string, param2: number, param3: boolean): void;
}

const BB: AA = {
  foo(/*trigger parameter hints here, see lovely results*/)
}

Playground. (use Ctrl/Cmd+Shift+Space to trigger parameter hints)
image

πŸ’» Use Cases

I'd use this when implementing abstract classes to remember the parameters I get to use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions