Skip to content

Extra ? added to method in method signature completion for optional method #46589

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

Closed
mjbvz opened this issue Oct 29, 2021 · 2 comments · Fixed by #46594
Closed

Extra ? added to method in method signature completion for optional method #46589

mjbvz opened this issue Oct 29, 2021 · 2 comments · Fixed by #46594
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Oct 29, 2021

Bug Report

🔎 Search Terms

  • Method signature completions
  • suggest / suggestions
  • completions

🕗 Version & Regression Information

4.5.0-dev.20211029

💻 Code

For the code:

interface IFoo {
    barOpt?(x: number): void;
}

class Foo implements IFoo {
    |
 }

Complete barOpt inside Foo

🙁 Actual behavior

barOpt gets added with a ?

interface IFoo {
    barOpt?(x: number): void;
}

class Foo implements IFoo {
    barOpt?(x: number): void {
        
    }
}

🙂 Expected behavior

Since we have implemented the method, I'd expect us the remove the ?

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Oct 29, 2021

This is especially true under exactOptionalPropertyTypes, but also who would ever want a sub-subclass to override with undefined?

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Good First Issue Well scoped, documented and has the green light Help Wanted You can do this labels Oct 29, 2021
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.5.2 milestone Oct 29, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 29, 2021
@DanielRosenwasser
Copy link
Member

Thanks @a-tarasyuk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Good First Issue Well scoped, documented and has the green light Help Wanted You can do this
Projects
None yet
3 participants