Typescript Quick Info Formatter Removes parentheses ()
from declared type on hovering, for conditionally inferring types
#48729
Labels
Milestone
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 typesThe text was updated successfully, but these errors were encountered: