Repository navigation
Typescript Quick Info Formatter Removes parentheses () from declared type on hovering, for conditionally inferring types #48729
Description
Activity
- addedBugA bug in TypeScriptA bug in TypeScriptHelp WantedYou can do thisYou can do this
on Apr 18, 2022 RyanCavanaugh commented
on Apr 18, 2022 MemberMore actionsIt sounds like you might be writing a tool that's taking some incorrect assumptions on how this can be used? FWIW text returned by quick info is not guaranteed to be something you can paste into a file. For example, we might in the future use placedholder text that is not legal code.
To be fair, as long as what the quick info is displaying is syntactically valid, it probably shouldn't change the behavior of the type, otherwise you're asking a human to parse valid code differently than the compiler would, which is confusing.
Reacted by Ryan Cavanaugh and ZzzenIt sounds like you might be writing a tool that's taking some incorrect assumptions on how this can be used? FWIW text returned by quick info is not guaranteed to be something you can paste into a file. For example, we might in the future use placeholder text that is not legal code.
Actually, I was moving the type definition from one file to another, so while hovering over the conditionally inferring type
Tail<T>
I noticed that wrapping parenthesis was not present, the rest were the sameHence my obvious conclusion was maybe both are interchangeable so I tried removing it from my actual Tail definition and there wasn't even a syntax/type error
I tried variadic tuples and extracting Tail and then I was able to narrow down the error to this Missing parenthesis and how the TS compiler sees it differently
So I think as long as it is a valid TS syntax, quick info should resolve to the same or equivalent type!
Whereas in this case, the quick info type got resolved toneverRyan Cavanaugh (@RyanCavanaugh) can you guide me on where does this transformation from type to string code might be happening that's used by quickInfo or any other pointers I should look into?
Maybe I can try to investigate it and fix it.
DanielRosenwasser commented
on May 4, 2022 MemberMore actionsThis was fixed by #48112, but thank you Mateusz Burzyński (@Andarist) for the test case!
- addedFixedA PR has been merged for this issueA PR has been merged for this issue
on May 4, 2022 - locked as resolved and limited conversation to collaborators
on Oct 22, 2025
Bug Report
Typescript Language Formatter function removes
parentheses ()from the declared type on hovering over it.Not a bug with the Typescript parser itself.
🔎 Search Terms
infer, conditional typing, parentheses, hover
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Wrapped
()gets removed on hovering from the declared conditional inferring type.Because of this the hovered type shown is not the same as the declared type and they are not interchangeable and can cause bugs.
Without parenthesis, the TS parses it as
a Type which returns a Function and the return type of the function is that conditional "void extends ..."which is not what was declared.Example -

🙂 Expected behavior
()should be preserved and shown while hovering so to prevent the errors that can arise because of missing()in the conditional inferring types