You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'C' is declared but its value is never read.
Cannot find name 'C_1'.
I think TS is probably trying to avoid C, since it assumes it's already reserved from if branch in the ternary type. Using different label does not produce the issue.
TypeScript Version: 4.0.2 (reproduced in 4.1.0-insiders.20200903 as well)
Search Terms:
template argument, overshadow argument, template argument aliasing
Code
This is the simplest MWE I could find. Strangely enough, using a generic type instead of function does not cause the error.
Expected behavior:
I expect to find this type in the resulting
*.d.ts
to be a valid TS code and the type of the object type branch in return to be:Actual behavior:
*.d.ts
is not a valid TS code according to the same version of TS. There is this newC_1
which is a reference error.I think TS is probably trying to avoid C, since it assumes it's already reserved from
if
branch in the ternary type. Using different label does not produce the issue.Playground Link: link
Related Issues: Maybe #40302 and #36311
The text was updated successfully, but these errors were encountered: