Skip to content

Poor autocomplete inside object literal as the return value of a getterΒ #58484

Open
@whzx5byb

Description

@whzx5byb

πŸ”Ž Search Terms

object literal getter completion

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.5.0-beta#code/JYOwLgpgTgZghgYwgAgILIN7IFDOTAewIAoBKALk2QAcoDrowBPAOTgFsJKQBXdgI2jIAvgG5cyfnCiUsteo1YcuyXgKFjsw7NgQEQAZzDI4ldAF5MEvIRKkqUCGB5QQVvB48B6L8gA8ALTIYFBMwUzUoADmyABE1LHIABbQENYewjiewgA0Op5RTpLSZO6eyI7OrlTpnj7+QSFhzJEgMfGJKY61IunawkA

πŸ’» Code

interface A { 
  foo(): { propertyName: number };
  bar: { propertyName: number };
}

const a: A = {
    foo() { return {
        // <- try typing "p" here
      } 
    },

    get bar() {
      return { 
        // <- try typing "p" here
      }
    }
}

πŸ™ Actual behavior

😊 Good completions inside the function body:

1

😒 Poor completions inside the getter body:

2

πŸ™‚ Expected behavior

It should provide the same completions inside a getter, as it does inside a function.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Completion ListsThe issue relates to showing completion lists in an editorHelp WantedYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions