Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter hints while overriding methods #42668

Open
5 tasks done
JacksonKearl opened this issue Feb 5, 2021 · 1 comment
Open
5 tasks done

Parameter hints while overriding methods #42668

JacksonKearl opened this issue Feb 5, 2021 · 1 comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@JacksonKearl
Copy link

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.

@DanielRosenwasser
Copy link
Member

Technically what you're seeing with the signature help on that method declaration is a bug, and I only haven't filed it because it's so helpful. πŸ˜…

The problem is that it's a bit misleading in the case of derived methods without #23911

@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants