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
A binding returned for a name does not compute as a reference when the name is used as a type reference, and there's a shadow for the name. For example, take as input the following code:
When running const binding = path.scope.getBinding('ConfigAPI') on the top-most scope, the binding is correctly returned. However, binding.references evaluates to 0.
If you rename the variable ConfigAPI to something else, binding.references will correctly compute 1 and count the type reference as a proper reference.
Babel thinks that : ConfigAPI references the new variable being introduced. For the type checker, though, the type reference will correctly point out to the correct symbol.
Environment
Babel version: 7.19.0 (but reproducible in multiple other environments)
The text was updated successfully, but these errors were encountered:
Hey @haskellcamargo! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.
How are you using Babel?
Programmatic API (
babel.transform
,babel.parse
)Input code
Interactive example here
Transformer
Input file
Current and expected behavior
A binding returned for a name does not compute as a reference when the name is used as a type reference, and there's a shadow for the name. For example, take as input the following code:
When running
const binding = path.scope.getBinding('ConfigAPI')
on the top-most scope, the binding is correctly returned. However,binding.references
evaluates to0
.If you rename the variable
ConfigAPI
to something else,binding.references
will correctly compute1
and count the type reference as a proper reference.Babel thinks that
: ConfigAPI
references the new variable being introduced. For the type checker, though, the type reference will correctly point out to the correct symbol.Environment
The text was updated successfully, but these errors were encountered: