π 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.
π Search Terms
type tuple completions
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAqgzhATgFQK5gDbQLxQNp4BEAdgIYC2EhANFHMIgJbEDmAurUaS1bcauQBGSDvkKkAJhMQQ4cGnQbN2bANwAoUJCgBBCeWZpMOfGvXqAxgHti9WAkQAue0iNYouAiQq8ohAEwAzMGEolw8CkHBYeJSMnIKAcGBoWZAA
π» Code
π Actual behavior
When I place the cursor inside the brackets of the empty tuple type and request completions:
the completion list suggests the value symbol
User(theconst), instead of type symbols. In particular, the first time the completion popup is opened it suggestsUser; closing and reopening the popup sometimes then suggestsUserTuple.π 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 oftype AdminTuple = stringwhere the completion after=correctly offersUserTuplebut notUser.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 suggestsUserinstead ofUserTuple.