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
I noticed a few spots in the jellyfin-roku app that they reuse the same variable name multiple times. In typescript this is not a big deal because let and const variables are block-scoped, so they'd only exist inside the if block. But in brs/bs, all variables exist at the function level.
Not sure how difficult this would be without implementing full-blown branch tracking, but perhaps we could do some specific logic to this exact use case: when a variable is defined, and there's very clear code following it. Like everything in the same block after the declaration would know it's just that one type.
Perhaps this might even be easier to just enable a bsconfig flag for enforcing block-scoped variables.
Anyway, just wanted to track this so we could have a conversation. There are several valid use cases where we just want to reuse the same variable name because it's temporary, but we don't want to lose the typing with it as it flows down the file.
The text was updated successfully, but these errors were encountered:
I noticed a few spots in the jellyfin-roku app that they reuse the same variable name multiple times. In typescript this is not a big deal because
let
andconst
variables are block-scoped, so they'd only exist inside theif
block. But in brs/bs, all variables exist at the function level.Not sure how difficult this would be without implementing full-blown branch tracking, but perhaps we could do some specific logic to this exact use case: when a variable is defined, and there's very clear code following it. Like everything in the same block after the declaration would know it's just that one type.
Perhaps this might even be easier to just enable a bsconfig flag for enforcing block-scoped variables.
Anyway, just wanted to track this so we could have a conversation. There are several valid use cases where we just want to reuse the same variable name because it's temporary, but we don't want to lose the typing with it as it flows down the file.
The text was updated successfully, but these errors were encountered: