createTempVariable() should also try to not shadowing upper lexical environment temp variables #40826
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
TypeScript Version: 3.9.3
Search Terms:
Code
I'm using createTempVariable but I found it is buggy.
The buggy version: Jack-Works/react@792a7f7#diff-6624517c3255932b3079f651161b7df0
Fixed version:
Jack-Works/react@4ae646b#diff-6624517c3255932b3079f651161b7df0
Reproduction:
The buggy result using
createTempVariable()
:As you can see, downleveling
??
syntax create a new variable also called "_a" which shadows my upper variable "_a", then_a()
leads to an runtime error.The correct version using
createFileLevelUniqueName()
:The text was updated successfully, but these errors were encountered: