Skip to content

Completions inside tuple types suggest value symbols instead of typesΒ #64145

Description

@luo2430

πŸ”Ž Search Terms

type tuple completions

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about code completion

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgzhATgFQK5gDbQLxQNp4BEAdgIYC2EhANFHMIgJbEDmAurUaS1bcauQBGSDvkKkAJhMQQ4cGnQbN2bANwAoUJCgBBCeWZpMOfGvXqAxgHti9WAkQAue0iNYouAiQq8ohAEwAzMGEolw8CkHBYeJSMnIKAcGBoWZAA

πŸ’» Code

type UserTuple = [["name", string], ["age", number], ["address", string]];
type AdminTuple = [];

const User: UserTuple = [["name", "2333"], ["age", 2333], ["address", "2333"]];

πŸ™ Actual behavior

When I place the cursor inside the brackets of the empty tuple type and request completions:

type AdminTuple = [];
//                ^ cursor here

the completion list suggests the value symbol User (the const), instead of type symbols. In particular, the first time the completion popup is opened it suggests User; closing and reopening the popup sometimes then suggests UserTuple.

πŸ™‚ Expected behavior

The position inside type AdminTuple = [] is a type-only location, so completions should offer type symbols (UserTuple) and should not offer value symbols (User). This matches the behavior of type AdminTuple = string where the completion after = correctly offers UserTuple but not User.

Additional information about the issue

The same wrong behavior also occurs after a trailing comma inside a tuple type, e.g. type T = [string, |] also suggests User instead of UserTuple.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions